typeId); my_Assert(null != $mo, ErrCode::err_const_no); return $mo; } public function __construct($args = 0) { if (isInt($args)) { $this->typeId = $args; $arr = array(); $cfg = GameConfig::taskcard_getItem($this->typeId); my_Assert(null != $cfg, ErrCode::err_const_no); foreach (explode(',', $cfg->tasksteps) as $taskStepTypeId) { $arr [] = new Ins_TaskStep($taskStepTypeId); } $this->curSteps = $arr; } else { parent::__construct($args); } } /** * @return boolean 分析任务卡是否已经完成所有步骤 */ public function IsFinish() { if ($this->state >= Enum_TaskCardStateType::finish) { # 已经完成 return true; } $isFinish = true; foreach ($this->curSteps as &$tsp) { # 初期里面只有一个任务 $tsp = new Ins_TaskStep($tsp); if (!$tsp->isFinish()) { $isFinish = false; break; } } return $isFinish; } public function AddStep($stpid) { $exists = false; foreach ($this->curSteps as $stp) { // $stp = new Ins_TaskStep($stp); if ($stp->typeId == $stpid) { $exists = true; } } if (!$exists) { $newstp = new Ins_TaskStep($stpid); $this->curSteps[] = $newstp; // $newstp->doStartAct(); } } }