PHP網頁遊戲學習之Xnova(ogame)源碼解讀(九)_php執行個體

來源:互聯網
上載者:User
十二、艦隊相關函數(unlocalised.php)

本節將把艦隊派遣相關的函數做個說明,繼續以注釋方式說明;由於這次涉及的函數比較多,需要花不少時間來整理消化。

// -------------------------------------------------------------------//// 以下是艦隊派遣需要用到的函數列表//// -------------------------------------------------------------------// 計算兩個星球之間的距離function GetTargetDistance ($OrigGalaxy, $DestGalaxy, $OrigSystem, $DestSystem,$OrigPlanet, $DestPlanet)// 計算艦隊到達指定距離需要的時間,這裡會考慮伺服器的倍速設定function GetMissionDuration ($GameSpeed, $MaxFleetSpeed, $Distance, $SpeedFactor)// 取得遊戲設定後的艦隊速度function GetGameSpeedFactor ()// 計算艦隊的最大速度function GetFleetMaxSpeed ($FleetArray, $Fleet, $Player)// 計算單個艦種的HH消耗function GetShipConsumption ( $Ship, $Player )// 計算艦隊的HH消耗,這裡就是實際的HH消耗量,傳入了很多參數function GetFleetConsumption ($FleetArray, $SpeedFactor, $MissionDuration,$MissionDistance, $FleetMaxSpeed, $Player)// -------------------------------------------------------------------//// 以下是字串的格式化顯示函數列表//// -------------------------------------------------------------------// 格式化時間,形如:xxd xxh xxmfunction pretty_time ($seconds)// 格式化分鐘,形如:xxminfunction pretty_time_hour ($seconds)// 建造時間格式,前面會有說明function ShowBuildTime ($time)//孤立函數,沒有被調用function add_points ($resources, $userid)//孤立函數,沒有被調用function remove_points ($resources, $userid)//孤立函數,沒有被調用function get_userdata ()// -------------------------------------------------------------------//// 以下是模板檔案的讀/寫/使用函數列表//// -------------------------------------------------------------------// 根據檔案名稱讀取檔案內容function ReadFromFile($filename)//孤立函數,沒有被調用function SaveToFile ($filename, $content)//前面介紹過,用$array的值進行替換function parsetemplate ($template, $array)//也介紹過,就是取得指定模板檔案的內容function gettemplate ($templatename)// include不同語言檔案function includeLang ($filename, $ext = '.mo')// -------------------------------------------------------------------//// 以下是艦隊連結類函數列表//// -------------------------------------------------------------------// 構造一個艦隊起始星球的星圖超連結function GetStartAdressLink ( $FleetRow, $FleetType )// 構造一個艦隊目的星球的星圖超連結function GetTargetAdressLink ( $FleetRow, $FleetType )// 構造一個指定星球的星圖超連結function BuildPlanetAdressLink ( $CurrentPlanet )// 構造一個給攻擊者的發送訊息到超連結function BuildHostileFleetPlayerLink ( $FleetRow )// 取得下次月門的開啟時間function GetNextJumpWaitTime ( $CurMoon )// 構造一個攻擊艦隊明細列表function CreateFleetPopupedFleetLink ( $FleetRow, $Texte, $FleetType )//構造一個返回艦隊的明細列表,包括有無資源function CreateFleetPopupedMissionLink ( $FleetRow, $Texte, $FleetType ) 
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.