/// 所处的课程id /// public $courseId = 1001; /** * 将领取课程奖励的保存在这 * @var type */ public $comCourseList = array(); /// /// 任务卡信息 /// //public List compMissCardList = new List(); public $compMissCardDic=null; /** * 当前课程进度,进入下一个课程清0 * @var type */ public $progress = 0; /** * 年级奖励领取记录 * @var type */ public $collegeRewardList = array(); /** * * @var type */ public $maskCollege = 0; /** * 构造函数 * @param type $args */ public function __construct($args = null) { if($args == null){ $this->compMissCardDic = new \stdClass(); } else { parent::__construct($args); } } public function initialize() { // $this->compMissCardDic = new \stdClass(); // $dic = GameConfig::course_getItem($this->courseId); // $misslist = explode(',',$dic->misslist); // foreach ($misslist as $id) { // $item = new ins_missCourseItem(); // $item->initialize($id); // $this->compMissCardDic->$id = $item; // } $this->initCompMissCardDic(); } public function initCompMissCardDic() { $this->compMissCardDic = new \stdClass(); $dic = GameConfig::course_getItem($this->courseId); $misslist = explode(',',$dic->misslist); foreach ($misslist as $id) { $item = new ins_missCourseItem(); $item->initialize($id); $this->compMissCardDic->$id = $item; } } /** * 修改任务卡状态 * @param type $id * @param type $state */ public function modifyTaskCardState($id,$state) { if(!StlUtil::dictHasProperty($this->compMissCardDic, $id)){ return; } $this->compMissCardDic->$id->type = $state; $this->progress += 1; } public function updataCourseNew() { //检测是否到下一年级 // $collegeDic = GameConfig::college_getItem($this->collegeId); // if(in_array($this->courseId +1,explode(',', $collegeDic->cList))){ // $this->courseId += 1; // $this->initCompMissCardDic(); // $this->progress = 0; // } else { $this->collegeRewardList[] = $this->collegeId; $this->collegeId += 1; $newCollegeDic = GameConfig::college_getItem($this->collegeId); if($newCollegeDic == null){ $this->maskCollege = Enum_College::finish; $this->collegeId -= 1; } elseif ($newCollegeDic != null && $newCollegeDic->cList == null) { $this->maskCollege = Enum_College::update; } else { $cList = explode(',', $newCollegeDic->cList); $this->courseId = $cList[0]; $this->initCompMissCardDic(); } // } } /** * */ public function updataCourse() { $this->comCourseList[] = $this->courseId; //检测是否到下一年级 $collegeDic = GameConfig::college_getItem($this->collegeId); if(in_array($this->courseId +1,explode(',', $collegeDic->cList))){ $this->courseId += 1; $this->initCompMissCardDic(); $this->progress = 0; } // else { // $this->collegeId += 1; // $newCollegeDic = GameConfig::college_getItem($this->collegeId); // $cList = explode(',', $newCollegeDic->cList); // $this->courseId = $cList[0]; // $this->initCompMissCardDic(); // $this->progress = 0; // } } public function checkCollege() { if($this->maskCollege == Enum_College::update){ $dic = GameConfig::college_getItem($this->collegeId); if($dic != null && $dic->cList != null){ $this->maskCollege = 0; $cList = explode(',', $dic->cList); $this->courseId = $cList[0]; $this->initCompMissCardDic(); } } } }