本文整理汇总了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();
}
示例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);
}
示例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;
}