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


PHP map::load_one方法代碼示例

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


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

示例1: __create

 public static function __create()
 {
     $trigger = new static();
     $trigger->sprite_url = 'not-found.png';
     $trigger->map_id = 1;
     $trigger->name = 'Trigger';
     $trigger->x = 50;
     $trigger->y = 50;
     $weaponDealer = clone $trigger;
     $weaponDealer->script = 'merchants/weapon_dealer';
     $weaponDealer->script_arguments = '{"min_level":0,"max_level":80}';
     $weaponDealer->name = 'Weapon Dealer';
     $weaponDealer->map_id = map::load_one('Trainee Village', 'name')->id;
     $weaponDealer->save();
     $weaponDealer->id = null;
     $weaponDealer->name = 'Weapon Dealer';
     $weaponDealer->map_id = map::load_one('Kinata', 'name')->id;
     $weaponDealer->save();
     $dungeonEntrance = clone $trigger;
     $dungeonEntrance->script = 'dungeon_entrance';
     $dungeonEntrance->script_arguments = '{"dungeon_script":"","modes":[0,1,2,3,4,5]}';
     $dungeonEntrance->name = 'Dungeon Entrance';
     $traineeCave = clone $dungeonEntrance;
     $traineeCave->script_arguments = '{"dungeon_script":"trainee_cave","modes":[0,1,2,3,4,5]}';
     $traineeCave->name = 'Trainee Cave';
     $traineeCave->map_id = map::load_one('Trainee Fields', 'name')->id;
     $traineeCave->save();
     $kinataUnderground = clone $dungeonEntrance;
     $kinataUnderground->script_arguments = '{"dungeon_script":"kinata_underground","modes":[0,1,2,3,4,5]}';
     $kinataUnderground->name = 'Kinata Underground';
     $kinataUnderground->x = 100;
     $kinataUnderground->y = 100;
     $kinataUnderground->map_id = map::load_one('Kinata', 'name')->id;
     $kinataUnderground->save();
 }
開發者ID:TorbenKoehn,項目名稱:lok,代碼行數:35,代碼來源:trigger.php

示例2: index_action

 public function index_action()
 {
     $char = character::current();
     $mapId = $char->map_id;
     $map = map::load_one($mapId);
     if (!$map) {
         page::redirect('/world/map-not-found');
     }
     $this->set('map', $map);
 }
開發者ID:TorbenKoehn,項目名稱:lok,代碼行數:10,代碼來源:world.php

示例3: map

 public function map($newMap = null)
 {
     static $map = null;
     if (!$map) {
         $map = map::load_one($this->map_id);
     }
     if ($newMap) {
         if ($newMap instanceof map) {
             $this->map_id = $newMap->id;
             $this->save();
             $map = $newMap;
         } else {
             if (is_int($newMap)) {
                 $this->map_id = $newMap;
                 $this->save();
                 $map = map::load_one($this->map_id);
             }
         }
     }
     return $map;
 }
開發者ID:TorbenKoehn,項目名稱:lok,代碼行數:21,代碼來源:character.php


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