1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?php
- namespace loyalsoft;
- /**
- * Description of UserGameHeroModel
- * @version
- * 1.0.0 Created at 2017-2-14. by --gwang
- * @author gwang (mail@wanggangzero.cn)
- * @copyright ? 2017-2-14, SJZ LoyalSoft Corporation & gwang. All rights reserved.
- */
- /**
- * 玩家收集的英雄的卡牌集合
- */
- class UserGameHeroModel extends Object_ext
- {
- /**
- * 当前展示的英雄的UID
- * @var type string
- */
- public $displayHeroUID;
- /**
- * 好友支援的英雄的UID
- * @var type string
- */
- public $firendSupportHeroUID;
- /**
- * 当前收集卡牌的数量上限(可扩容)
- * @var type int
- */
- public $maxCollectCount;
- /**
- * 英雄集合
- * @var {}
- */
- public $collectHeros;
- /**
- * 记录一下曾经的最大UID
- * @var type int
- */
- public $recordMaxUID;
- /**
- *
- * @param CRedisUtil $mem
- */
- public function InitializeHero()
- {
- $this->displayHeroUID = null;
- $this->firendSupportHeroUID = null;
- $this->maxCollectCount = glc()->Game_CollectHero_BasicMaxCount;
- $this->recordMaxUID = 0;
- $this->collectHeros = ObjectInit();
- # 设置初始英雄
- $hids = GameConfig::primordial_data()->User_Heros;
- foreach ($hids as $heroModelId) {
- //1.检查是否存在这个英雄的模板
- $heroCfg = GameConfig::hero_getItem($heroModelId);
- if ($heroCfg) {
- $uid = HeroProc::CreateNewGameHeroUID($this->collectHeros, $this->recordMaxUID);
- $this->recordMaxUID = $uid;
- $hero = HeroProc::getGameHeroModelInstance($heroCfg, $heroModelId, $uid);
- $this->collectHeros->$uid = $hero;
- $this->displayHeroUID = $uid;
- $this->firendSupportHeroUID = $uid;
- }
- }
- }
- }
|