Info_Heros.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace loyalsoft;
  8. /**
  9. * Description of Info_Heros
  10. *
  11. * @author c'y'zhao
  12. */
  13. class Info_Heros extends Object_ext {
  14. /**
  15. * 当前的hero
  16. */
  17. public $CurrentHeroId = 0;
  18. /**
  19. * 所有的hero集合
  20. * @var type
  21. */
  22. public $Dic = null;
  23. /**
  24. * 角色卡解锁英雄记录
  25. * @var type
  26. */
  27. #[ArrayType]
  28. public $roleCardUnlockHeroList = array();
  29. /**
  30. * 初始化玩家英雄数据
  31. */
  32. public function initialize() {
  33. $heroConf = GameConfig::hero();
  34. foreach ($heroConf as $heroId => $mo) {
  35. if (!StlUtil::dictHasProperty($this->Dic, $heroId) && $mo->starLv == 1) {
  36. $insHero = new Ins_Hero();
  37. $insHero->Id = $heroId;
  38. $insHero->isUnlock = 0;
  39. if ($mo->isDefaultUnlock == 1) {
  40. $insHero->isUnlock = 1;
  41. }
  42. $this->Dic->$heroId = $insHero;
  43. }
  44. }
  45. if ($this->CurrentHeroId == 0) {
  46. $this->CurrentHeroId = glc()->CreateUserGame_defaultHeroId;
  47. }
  48. }
  49. public function __construct($arg = null) {
  50. if ($arg == null) {
  51. $this->Dic = new \stdClass();
  52. } else {
  53. parent::__construct($arg);
  54. }
  55. }
  56. }