當前位置: 首頁>>代碼示例>>PHP>>正文


PHP game::ranks方法代碼示例

本文整理匯總了PHP中game::ranks方法的典型用法代碼示例。如果您正苦於以下問題:PHP game::ranks方法的具體用法?PHP game::ranks怎麽用?PHP game::ranks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在game的用法示例。


在下文中一共展示了game::ranks方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: init

 public static function init()
 {
     // hent innstillinger
     self::$settings = cache::fetch("settings");
     if (!self::$settings) {
         // hent ny data
         require PATH_APP . "/scripts/update_db_settings.php";
     }
     // hent bydeler
     self::$bydeler = cache::fetch("bydeler");
     if (!self::$bydeler) {
         // hent ny data
         require PATH_APP . "/scripts/update_db_bydeler.php";
     }
     // hent ranker
     self::$ranks = cache::fetch("ranks");
     if (!self::$ranks) {
         // hent ny data
         require PATH_APP . "/scripts/update_db_ranks.php";
     }
 }
開發者ID:Kuzat,項目名稱:kofradia,代碼行數:21,代碼來源:class.game.php

示例2: array

<?php

// denne filen henter informasjon om rankene og lagrer til cache
game::$ranks = array("items" => array(), "items_number" => array(), "pos" => array(), "pos_max" => 0);
// hent rankene
$result = \Kofradia\DB::get()->query("SELECT id, name, points, rank_max_health, rank_max_energy FROM ranks ORDER BY points");
// sett opp data
$i = 0;
$last_id = 0;
while ($row = $result->fetch()) {
    // oppdater need_points til den forrige raden
    if ($last_id) {
        game::$ranks['items'][$last_id]['need_points'] = $row['points'] - game::$ranks['items'][$last_id]['points'];
        game::$ranks['items_number'][$i]['need_points'] = $row['points'] - game::$ranks['items'][$last_id]['points'];
    }
    $row['number'] = ++$i;
    game::$ranks['items'][$row['id']] = $row;
    game::$ranks['items_number'][$i] = game::$ranks['items'][$row['id']];
    $last_id = $row['id'];
}
// oppdater need_points til den siste raden
if ($last_id) {
    game::$ranks['items'][$last_id]['need_points'] = 0;
    game::$ranks['items_number'][$i]['need_points'] = 0;
}
// hent rankene for posisjonene
$result = \Kofradia\DB::get()->query("SELECT pos, name FROM ranks_pos ORDER BY pos");
$i = 0;
while ($row = $result->fetch()) {
    $row['number'] = ++$i;
    game::$ranks['pos'][$row['pos']] = $row;
開發者ID:Kuzat,項目名稱:kofradia,代碼行數:31,代碼來源:update_db_ranks.php


注:本文中的game::ranks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。