Info_College.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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. * @param type $args
  41. */
  42. public function __construct($args = null) {
  43. if($args == null){
  44. $this->compMissCardDic = new \stdClass();
  45. } else {
  46. parent::__construct($args);
  47. }
  48. }
  49. public function initialize() {
  50. // $this->compMissCardDic = new \stdClass();
  51. // $dic = GameConfig::course_getItem($this->courseId);
  52. // $misslist = explode(',',$dic->misslist);
  53. // foreach ($misslist as $id) {
  54. // $item = new ins_missCourseItem();
  55. // $item->initialize($id);
  56. // $this->compMissCardDic->$id = $item;
  57. // }
  58. $this->initCompMissCardDic();
  59. }
  60. public function initCompMissCardDic() {
  61. $this->compMissCardDic = new \stdClass();
  62. $dic = GameConfig::course_getItem($this->courseId);
  63. $misslist = explode(',',$dic->misslist);
  64. foreach ($misslist as $id) {
  65. $item = new ins_missCourseItem();
  66. $item->initialize($id);
  67. $this->compMissCardDic->$id = $item;
  68. }
  69. }
  70. /**
  71. * 修改任务卡状态
  72. * @param type $id
  73. * @param type $state
  74. */
  75. public function modifyTaskCardState($id,$state) {
  76. if(!StlUtil::dictHasProperty($this->compMissCardDic, $id)){
  77. return;
  78. }
  79. $this->compMissCardDic->$id->type = $state;
  80. $this->progress += 1;
  81. }
  82. public function updataCourseNew() {
  83. //检测是否到下一年级
  84. // $collegeDic = GameConfig::college_getItem($this->collegeId);
  85. // if(in_array($this->courseId +1,explode(',', $collegeDic->cList))){
  86. // $this->courseId += 1;
  87. // $this->initCompMissCardDic();
  88. // $this->progress = 0;
  89. // } else {
  90. $this->collegeId += 1;
  91. $newCollegeDic = GameConfig::college_getItem($this->collegeId);
  92. $cList = explode(',', $newCollegeDic->cList);
  93. $this->courseId = $cList[0];
  94. $this->initCompMissCardDic();
  95. // }
  96. }
  97. /**
  98. *
  99. */
  100. public function updataCourse() {
  101. array_pushs($this->comCourseList, $this->courseId);
  102. //检测是否到下一年级
  103. $collegeDic = GameConfig::college_getItem($this->collegeId);
  104. if(in_array($this->courseId +1,explode(',', $collegeDic->cList))){
  105. $this->courseId += 1;
  106. $this->initCompMissCardDic();
  107. $this->progress = 0;
  108. }
  109. // else {
  110. // $this->collegeId += 1;
  111. // $newCollegeDic = GameConfig::college_getItem($this->collegeId);
  112. // $cList = explode(',', $newCollegeDic->cList);
  113. // $this->courseId = $cList[0];
  114. // $this->initCompMissCardDic();
  115. // $this->progress = 0;
  116. // }
  117. }
  118. }