Info_College.php 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <?php
  2. namespace loyalsoft;
  3. /*
  4. * To change this license header, choose License Headers in Project Properties.
  5. * To change this template file, choose Tools | Templates
  6. * and open the template in the editor.
  7. */
  8. namespace loyalsoft;
  9. /**
  10. * Description of CollegeInfo
  11. *
  12. * @author cyzhao
  13. */
  14. class Info_College extends Object_ext{
  15. /**
  16. * 当前所在的级别
  17. */
  18. public $collegeId = 1;
  19. /// <summary>
  20. /// 所处的课程id
  21. /// </summary>
  22. public $courseId = 1001;
  23. /**
  24. * 将领取课程奖励的保存在这
  25. * @var type
  26. */
  27. public $comCourseList = array();
  28. /// <summary>
  29. /// 任务卡信息
  30. /// </summary>
  31. //public List<missCourseItem> compMissCardList = new List<missCourseItem>();
  32. public $compMissCardDic=null;
  33. /**
  34. * 当前课程进度,进入下一个课程清0
  35. * @var type
  36. */
  37. public $progress = 0;
  38. /**
  39. * 年级奖励领取记录
  40. * @var type
  41. */
  42. public $collegeRewardList = array();
  43. /**
  44. * 构造函数
  45. * @param type $args
  46. */
  47. public function __construct($args = null) {
  48. if($args == null){
  49. $this->compMissCardDic = new \stdClass();
  50. } else {
  51. parent::__construct($args);
  52. }
  53. }
  54. public function initialize() {
  55. // $this->compMissCardDic = new \stdClass();
  56. // $dic = GameConfig::course_getItem($this->courseId);
  57. // $misslist = explode(',',$dic->misslist);
  58. // foreach ($misslist as $id) {
  59. // $item = new ins_missCourseItem();
  60. // $item->initialize($id);
  61. // $this->compMissCardDic->$id = $item;
  62. // }
  63. $this->initCompMissCardDic();
  64. }
  65. public function initCompMissCardDic() {
  66. $this->compMissCardDic = new \stdClass();
  67. $dic = GameConfig::course_getItem($this->courseId);
  68. $misslist = explode(',',$dic->misslist);
  69. foreach ($misslist as $id) {
  70. $item = new ins_missCourseItem();
  71. $item->initialize($id);
  72. $this->compMissCardDic->$id = $item;
  73. }
  74. }
  75. /**
  76. * 修改任务卡状态
  77. * @param type $id
  78. * @param type $state
  79. */
  80. public function modifyTaskCardState($id,$state) {
  81. if(!StlUtil::dictHasProperty($this->compMissCardDic, $id)){
  82. return;
  83. }
  84. $this->compMissCardDic->$id->type = $state;
  85. $this->progress += 1;
  86. }
  87. public function updataCourseNew() {
  88. //检测是否到下一年级
  89. // $collegeDic = GameConfig::college_getItem($this->collegeId);
  90. // if(in_array($this->courseId +1,explode(',', $collegeDic->cList))){
  91. // $this->courseId += 1;
  92. // $this->initCompMissCardDic();
  93. // $this->progress = 0;
  94. // } else {
  95. $this->collegeRewardList[] = $this->collegeId;
  96. $this->collegeId += 1;
  97. $newCollegeDic = GameConfig::college_getItem($this->collegeId);
  98. $cList = explode(',', $newCollegeDic->cList);
  99. $this->courseId = $cList[0];
  100. $this->initCompMissCardDic();
  101. // }
  102. }
  103. /**
  104. *
  105. */
  106. public function updataCourse() {
  107. $this->comCourseList[] = $this->courseId;
  108. //检测是否到下一年级
  109. $collegeDic = GameConfig::college_getItem($this->collegeId);
  110. if(in_array($this->courseId +1,explode(',', $collegeDic->cList))){
  111. $this->courseId += 1;
  112. $this->initCompMissCardDic();
  113. $this->progress = 0;
  114. }
  115. // else {
  116. // $this->collegeId += 1;
  117. // $newCollegeDic = GameConfig::college_getItem($this->collegeId);
  118. // $cList = explode(',', $newCollegeDic->cList);
  119. // $this->courseId = $cList[0];
  120. // $this->initCompMissCardDic();
  121. // $this->progress = 0;
  122. // }
  123. }
  124. }