TK = $ntk; $this->save_tag("TK"); # 标记回存 } /** * 用于给各个字段赋默认初始值 * @return \UserGameModel */ public function initialize() { $this->base(true)->initialize(); $this->store(true)->initialize(); $this->gates(true)->initialize(); $this->heros(true)->initialize(); $this->privateData(true)->initialize(); $this->task(true)->initialize(); } /** * 构造函数 * @param type $arg */ public function __construct($arg = null) { if (null === $arg) { # 未传参数的情况下 $this->baseInfo = new Info_UserBase(); $this->store = new Info_Store(); $this->gates = new Info_Gates(); $this->heros = new Info_Heros(); $this->privateState = new Info_PrivateState(); $this->task = new Info_Task(); } else { # 实参 parent::__construct($arg); # 调用Object的构造函数 $this->base()->fixArray(); $this->privateData()->fixArray(); $this->gates()->fixArray(); $this->heros()->fixArray(); $this->task()->fixArray(); $this->store()->fixArray(); //$this-> $exploreAreas = $this->store()->exploreArea; if ($exploreAreas != null) { $dic = new \stdClass(); foreach ($this->store()->exploreArea as $areaId => $area) { $Ins_ExploreArea = new Ins_ExploreArea($area); $Ins_ExploreArea->fixArray(); $dic->$areaId = $Ins_ExploreArea; } $this->store()->exploreArea = $dic; } } } // /** * 关卡数据 * @param bool $save 是否需要回存 * @return Info_Gates */ public function gates($save = true) { $this->gates = new Info_Gates($this->gates); if ($save) { $this->save_tag("gates"); } return $this->gates; } /** * 基础信息 * @param bool $save 是否需要回存 * @return Info_UserBase */ public function base($save = true) { $this->baseInfo = new Info_UserBase($this->baseInfo); if ($save) { $this->save_tag("baseInfo"); } return $this->baseInfo; } /** * 玩家仓库 * @param bool $save 是否需要回存 * @return Info_Store */ public function store($save = true) { $this->store = new Info_Store($this->store); if ($save) { $this->save_tag("store"); } return $this->store; } /** * 商店数据 * @param bool $save 是否需要回存 * @return Info_UserShop */ public function shop($save = true) { $this->shopdata = new Info_UserShop($this->shopdata); if ($save) { $this->save_tag("shopdata"); } return $this->shopdata; } /** * 神秘商店 * @param bool $save 是否需要回存 * @return Info_UserSecretshop */ public function secretshop($save = true) { $this->userSecretshop = new Info_UserSecretshop($this->userSecretshop); if ($save) { $this->save_tag("userSecretshop"); } return $this->userSecretshop; } /** * 英雄数据 * @param bool $save 是否需要回存 * @return Info_UserGameHero */ public function heros($save = true) { $this->heros = new Info_Heros($this->heros); if ($save) { $this->save_tag("heros"); } return $this->heros; } /** * 私有数据 * @param bool $save 是否需要回存 * @return Info_PrivateState */ public function privateData($save = true) { $this->privateState = new Info_PrivateState($this->privateState); if ($save) { $this->save_tag("privateState"); } return $this->privateState; } /** * 任务卡商店 * @param bool $save 是否需要回存 * @return Info_Task */ public function task($save = true) { $this->task = new Info_Task($this->task); if ($save) { $this->save_tag("task"); } return $this->task; } /** * 角色画像数据 * @param bool $save 是否需要回存 * @return Data_UserProfile */ public function profile($save = true) { $this->profile = new Data_UserProfile($this->profile); if ($save) { $this->save_tag("profile"); } return $this->profile; } // // }