CurrentGateId = $startId; $this->UnlockedGatesMaxId = $startId; $this->GateList = new \stdClass(); $Ins_GateInfo = new Ins_GateInfo(); $Ins_GateInfo->GateId = $this->CurrentGateId; $this->GateList->$startId = $Ins_GateInfo; $this->GatesChallengeRecord = new \stdClass(); $this->xunluo_StartTs = now(); } public function __construct($arg = null) { if ($arg == null) { if ($this->CurrentGateId == 0) { $startId = 1; $this->CurrentGateId = $startId; $this->UnlockedGatesMaxId = $startId; $this->GateList = new \stdClass(); $Ins_GateInfo = new Ins_GateInfo(); $Ins_GateInfo->GateId = $this->CurrentGateId; $this->GateList->$startId = $Ins_GateInfo; } $this->GatesChallengeRecord = new \stdClass(); $this->xunluo_StartTs = now(); } else { parent::__construct($arg); } } /** * 当前关卡信息 * @return Ins_GateInfo */ public function CurGateInfo() { $gateId = $this->CurrentGateId; my_Assert(StlUtil::dictHasProperty($this->GateList, $gateId), ErrCode::user_Gate_NoUserGateInfo); $gateInfo = ctx()->gates->GateList->$gateId; return $gateInfo; } /** * @return 解锁下一剧情关卡 */ public function UnlockNextPlotGate() { $nextId = $this->CurrentGateId; foreach (GameConfig::gate() as $k => $v) { isEditor() and $v = new \sm_gate(); if ($v->unlockGateId == $this->CurrentGateId) { $nextId = $v->gateId; } } if (!StlUtil::dictHasProperty($this->GateList, $nextId)) { $this->CurrentGateId = $nextId; $this->UnlockedGatesMaxId = $nextId; $gate = new Ins_GateInfo(); $gate->GateId = $nextId; $this->GateList->$nextId = $gate; } return $nextId; } }