private bool IsBeastActive(int unBeastId, bool bIncludeTemp) { CBeastData data = null; Dictionary <int, CBeastData> dictionary = this.m_roleAllInfo.m_oBeastInfo.m_oBeastMap; dictionary.TryGetValue((int)unBeastId, out data); bool result = false; if (data != null && data.m_wLevel > 0) { result = true; } else { if (!bIncludeTemp) { result = false; } else { this.m_dicTempBeastMap.TryGetValue(unBeastId, out data); result = (data != null && data.m_wLevel > 0); } } return(result); }
/// <summary> /// 显示角色的基础信息,比如血量,速度,攻击距离等 /// </summary> public void RefreshPlayerRoleInfo() { if (base.Prepared) { int beastTypeId = Singleton <BeastRole> .singleton.Beast.BeastTypeId; DataBeastlist data = GameData <DataBeastlist> .dataMap[beastTypeId]; if (data != null) { base.uiBehaviour.m_Label_RoleName.SetText(data.Name); string beastIconIndex = Singleton <RoomManager> .singleton.GetBeastIcon(Singleton <BeastRole> .singleton.Beast.Id); base.uiBehaviour.m_Sprite_AvatarIcon.SetSprite(beastIconIndex, UIManager.singleton.GetAtlasName(EnumAtlasType.Beast, beastIconIndex)); CBeastData beastData = Singleton <PlayerRole> .singleton.GetBeastData(beastTypeId, true); if (beastData != null) { //这里是玩家数量度这些,无关紧要 } } Color color = Singleton <BeastRole> .singleton.Beast.IsDead ? UnityTools.GrayColor : Color.white; base.uiBehaviour.m_Sprite_AvatarIcon.Color = color; int hp = Singleton <BeastRole> .singleton.Beast.Hp; int hpMax = Singleton <BeastRole> .singleton.Beast.HpMax; string text = string.Format("Life {0}/{1}", hp, hpMax); base.uiBehaviour.m_Label_Life.SetText(text); base.uiBehaviour.m_Label_Speed.SetText(string.Format("Speed {0}", Singleton <BeastRole> .singleton.Beast.MaxMoveDis.ToString())); } }
public void AddTempBeastData(CBeastData beastData) { if (beastData != null) { this.m_dicTempBeastMap[beastData.m_dwID] = beastData; } }
public CBeastData GetBeastData(int beastTypeId) { CBeastData result = null; CBeastInfo oBeastInfo = this.m_roleAllInfo.m_oBeastInfo; if (oBeastInfo != null) { oBeastInfo.m_oBeastMap.TryGetValue(beastTypeId, out result); } return(result); }
public override CByteStream DeSerialize(CByteStream bs) { this.m_oBeastMap.Clear(); int num = 0; bs.Read(ref num); for (int i = 0; i < num; i++) { int key = 0; CBeastData CBeastData = new CBeastData(); bs.Read(ref key); bs.Read(CBeastData); this.m_oBeastMap.Add(key, CBeastData); } return(bs); }
/// <summary> /// 取得玩家拥有的神兽信息,是否有包括周免 /// </summary> /// <param name="beastTypeId"></param> /// <param name="bContainFree"></param> /// <returns></returns> public CBeastData GetBeastData(int beastTypeId, bool bContainFree) { CBeastData cBeastData = this.GetBeastData(beastTypeId); if (bContainFree) { CBeastInfo info = this.m_roleAllInfo.m_oBeastInfo; if (info != null && info.m_oWeekBeastMap.ContainsKey(beastTypeId)) { CBeastData cWeekBeastData = info.m_oWeekBeastMap[beastTypeId]; if (cBeastData == null) { cBeastData = cWeekBeastData; } } } return(cBeastData); }
public override CByteStream DeSerialize(CByteStream bs) { bs.Read(ref this.m_unPlayerID); bs.Read(ref this.m_unLevel); bs.Read(ref this.m_strName); bs.Read(ref this.m_strIcon); bs.Read(ref this.m_btIsReconnecting); bs.Read(this.m_lBeastList); this.m_oBeastMap.Clear(); int num = 0; bs.Read(ref num); for (int i = 0; i < num; i++) { int key = 0; CBeastData data = new CBeastData(); bs.Read(ref key); bs.Read(data); this.m_oBeastMap.Add(key, data); } return(bs); }
/// <summary> /// 玩家确认选择该神兽 /// </summary> /// <param name="unRoleId"></param> /// <param name="unBeastTypeId"></param> /// <param name="unBeastLevel"></param> /// <param name="oSkillList"></param> /// <param name="btIsRandom"></param> /// <param name="nSuitId"></param> public void OnPlayerSelectBeast(long unRoleId, int unBeastTypeId, int unBeastLevel, ref List <int> oSkillList, byte btIsRandom, int nSuitId) { BeastData beastData = null; foreach (var current in this.m_listEnemyPlayers) { for (int i = 0; i < current.Beasts.Count; i++) { BeastData beast = current.Beasts[i]; if (beast.Id == unRoleId) { beastData = beast; beast.BeastTypeId = unBeastTypeId; beast.BeastLevel = unBeastLevel; beast.IsRandom = (btIsRandom > 0); beast.SuitId = nSuitId; beast.Skills.Clear(); foreach (var skill in oSkillList) { SkillGameData data = new SkillGameData(skill); beast.Skills.Add(data); } } } } foreach (var current in this.m_listOurPlayers) { for (int i = 0; i < current.Beasts.Count; i++) { BeastData beast = current.Beasts[i]; if (beast.Id == unRoleId) { beastData = beast; beast.BeastTypeId = unBeastTypeId; beast.BeastLevel = unBeastLevel; beast.IsRandom = (btIsRandom > 0); beast.SuitId = nSuitId; beast.Skills.Clear(); foreach (var skill in oSkillList) { SkillGameData data = new SkillGameData(skill); beast.Skills.Add(data); } } } } if (beastData != null) { if (!beastData.IsRandom) { DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.RefreshPlayerInfo(beastData); if (beastData.Id == DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.CurSelectBeastId) { } } if (beastData.PlayerId == Singleton <PlayerRole> .singleton.ID) { CBeastData data = new CBeastData(unBeastTypeId, 0, unBeastLevel, nSuitId); data.m_oSkillList.AddRange(oSkillList); data.m_oSuitList.Add(nSuitId); Singleton <PlayerRole> .singleton.AddTempBeastData(data); } } else { this.m_log.Error("null == beastDataCur:unBeastId:" + unRoleId); } BeastData beastData1 = this.GetBeastData(unRoleId); if (beastData.PlayerId == Singleton <PlayerRole> .singleton.ID) { //刷新技能 DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.RefreshSkill(beastData1); } }