UserGameHeroModel.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * Description of UserGameHeroModel
  5. * @version
  6. * 1.0.0 Created at 2017-2-14. by --gwang
  7. * @author gwang (mail@wanggangzero.cn)
  8. * @copyright ? 2017-2-14, SJZ LoyalSoft Corporation & gwang. All rights reserved.
  9. */
  10. /**
  11. * 玩家收集的英雄的卡牌集合
  12. */
  13. class UserGameHeroModel extends Object_ext {
  14. /**
  15. * 当前展示的英雄的UID
  16. * @var type string
  17. */
  18. public $displayHeroUID;
  19. /**
  20. * 好友支援的英雄的UID
  21. * @var type string
  22. */
  23. public $firendSupportHeroUID;
  24. /**
  25. * 当前收集卡牌的数量上限(可扩容)
  26. * @var type int
  27. */
  28. public $maxCollectCount;
  29. /**
  30. * 英雄集合
  31. * @var {}
  32. */
  33. public $collectHeros;
  34. /**
  35. * 记录一下曾经的最大UID
  36. * @var type int
  37. */
  38. public $recordMaxUID;
  39. /**
  40. *
  41. * @param CRedisUtil $mem
  42. */
  43. public function InitializeHero() {
  44. $this->displayHeroUID = null;
  45. $this->firendSupportHeroUID = null;
  46. $this->maxCollectCount = glc()->Game_CollectHero_BasicMaxCount;
  47. $this->recordMaxUID = 0;
  48. $this->collectHeros = ObjectInit(); # 初始化英雄集合
  49. $hids = GameConfig::primordial_data()->User_Heros; # 设置初始英雄
  50. foreach ($hids as $heroModelId) {
  51. $uid = HeroProc::CreateNewGameHeroUID($this->collectHeros, $this->recordMaxUID);
  52. $this->recordMaxUID = $uid;
  53. $hero = HeroProc::getGameHeroModelInstance($heroModelId, $uid);
  54. $this->collectHeros->$uid = $hero;
  55. $this->displayHeroUID = $uid;
  56. $this->firendSupportHeroUID = $uid;
  57. }
  58. }
  59. }