12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?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 Info_UserGameHero 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; # 设置初始英雄
- my_Assert(null != $hids, ErrCode::err_const_no);
- foreach ($hids as $heroModelId_yanlingid) {
- list($heroModelId, $yanlingId) = explode('_', $heroModelId_yanlingid);
- $uid = HeroProc::CreateNewGameHeroUID($this->collectHeros, $this->recordMaxUID);
- $this->recordMaxUID = $uid;
- $hero = HeroProc::getGameHeroModelInstance($heroModelId, $uid);
- StatisticsProc::TargetStatistics(Enum_TargetStatistics::HuanLingShiId_UserNum, $heroModelId);
- StatisticsProc::TargetStatistics(Enum_TargetStatistics::HuanLingShiLevel_UserNum, $heroModelId,"1");
- // // 初始化言灵
- // $yanlingMo = GameConfig::item_yanling_getItem($yanlingId);
- // my_Assert(null != $yanlingMo, ErrCode::err_const_no);
- // $yl_uid = StoreProc::PutYanLingInStore($yanlingMo->typeId, req());
- // ctx()->store->yanling->$yl_uid->herouid = $uid;
- // $position = $yanlingMo->position;
- // $hero->yanling->$position = array("itemuid" => $yl_uid); # 装备位置
- $this->collectHeros->$uid = $hero;
- $this->displayHeroUID = $uid;
- $this->firendSupportHeroUID = $uid;
- }
- }
- /**
- *
- * @param type $heroMoId
- */
- public function GetHeroByMoID($heroMoId) {
- my_Assert(null != $this->collectHeros, ErrCode::err_innerfault);
- foreach ($this->collectHeros as $hid => $hero) {
- isEditor() and $hero = new Ins_UserHero();
- if ($hero->typeId == $heroMoId) {
- return $hero;
- }
- }
- return null;
- }
- }
|