123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- namespace loyalsoft;
- /**
- * Description of Info_Gates
- *
- * @author c'y'zhao
- */
- class Info_Gates extends Object_ext {
- /**
- * 当前剧情选择的关卡
- */
- public $CurrentGateId = 0;
- /**
- * 已解锁剧情关卡的最大id
- * @var type
- */
- public $UnlockedGatesMaxId = 0;
- /**
- * 章节列表
- * @var Ins_GateInfo
- */
- public $GateList = null;
- /**
- * 挑战功能领取记录
- * @var type
- */
- public $GatesChallengeRecord = null;
- /**
- * 进化解锁记录
- * @var type
- */
- #[ArrayType]
- public $evolveUnlockRecord = array();
- /**
- * 巡逻领取奖励的时间
- * @var int
- */
- public $xunluo_StartTs = 0;
- /**
- * 快速巡逻的购买记录
- * @var int
- */
- public $xunluo_quick_buyRecord = 0;
-
- /**
- * 进化左边解锁最大值得记录
- * @var type
- */
- public $evolveMaxId_left = 0;
-
- /**
- * 进化右边解锁最大值得记录
- * @var type
- */
- public $evolveMaxId_right = 0;
- public function initialize() {
- $startId = 10010121;
- $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();
- }
- 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;
- }
- }
|