private void LoadModelFinished() { if (null == this.m_beastModelObj) { this.m_log.Error("heroModelObj is null"); } else { UnityEngine.Object.DontDestroyOnLoad(this.m_beastModelObj); this.m_beastBehaviour = this.m_beastModelObj.AddComponent <BeastBehaviour>(); this.m_beastBehaviour.Beast = this; this.m_beastBehaviour.transform.parent = UnityGameEntry.Instance.BeastRoot; DataBeastlist dataById = GameData <DataBeastlist> .dataMap[this.m_dwBeastTypeId]; if (dataById != null && dataById.Movementspeed != 0f) { this.m_beastBehaviour.MoveSpeed = dataById.Movementspeed; } if (Singleton <RoomManager> .singleton.IsObserver) { this.PlayAnim("Idle"); } this.SetVisible(this.m_bVisible); if (this.m_bVisible) { this.MoveAction(this.m_vec3HexPos); } } }
/// <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 static List <int> GetExtraSkills(this DataBeastlist dataHeroList) { List <int> list = new List <int>(); List <int> result; if (string.IsNullOrEmpty(dataHeroList.ExtraSkill)) { result = list; } else { string[] array = dataHeroList.ExtraSkill.Split(new char[] { ';' }); for (int i = 0; i < array.Length; i++) { string value = array[i]; int item = Convert.ToInt32(value); list.Add(item); } result = list; } return(result); }
public void ConfirmBeast(long beastId) { PlayerData playerData = this.GetPlayerData(beastId); BeastData beastData = this.GetBeastData(beastId); if (playerData != null && beastData != null) { if (this.m_dicPlayerInGameBeastData.ContainsKey(playerData.PlayerId)) { this.m_dicPlayerInGameBeastData[playerData.PlayerId].Add(beastData); } else { m_log.Error("没有找到玩家ID对应的神兽数据"); } DataBeastlist dataList = null; GameData <DataBeastlist> .dataMap.TryGetValue(beastData.BeastTypeId, out dataList); if (dataList != null) { DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.OnRecvChat(playerData.Name, dataList.Name, dataList.NickName, beastData.IsRandom, playerData.CampType); DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.ShowCampTypeEffect(beastId); } } }
/// <summary> /// 刷新所有己方角色信息 /// </summary> public void RefreshAllRole() { if (Singleton <RoomManager> .singleton.MatchType == EMatchtype.MATCH_1C3) { if (base.Prepared) { List <Beast> list = Singleton <BeastManager> .singleton.GetAllBeastByCamp(Singleton <PlayerRole> .singleton.CampType); for (int i = 0; i < list.Count; i++) { IXUIListItem item = base.uiBehaviour.m_List_RoleList.GetItemByIndex(i); if (null == item) { item = base.uiBehaviour.m_List_RoleList.AddListItem(); } Beast beast = list[i]; item.Id = beast.Id; DataBeastlist data = GameData <DataBeastlist> .dataMap[beast.BeastTypeId]; int hp = beast.Hp; int hpMax = beast.HpMax; string text = string.Format("{0}/{1}", hp, hpMax); if (data != null) { item.SetText("lb_roleName", data.Name); //设置神兽名称 item.SetText("lb_life", text); //设置神兽血量 item.SetIconSprite(data.IconFile, UIManager.singleton.GetAtlasName(EnumAtlasType.Beast, data.IconFile)); } } } } }
/// <summary> /// 显示神兽信息界面 /// </summary> /// <param name="item"></param> /// <param name="playerData"></param> /// <param name="beastData"></param> private void ShowBeastInfo(IXUIListItem item, PlayerData playerData, BeastData beastData) { if (item != null && playerData != null && beastData != null) { item.SetText("NickNameAndLevel/Label_Player_Name", playerData.Name); item.SetText("NickNameAndLevel/Label_Player_Level", "LV" + playerData.Level); item.SetSprite("Icon/Sprite_Player_Icon", playerData.Icon); DataBeastlist beastList = GameData <DataBeastlist> .dataMap[beastData.BeastTypeId]; if (beastList != null) { //取得皮肤数据 DataSuit suit = null; GameData <DataSuit> .dataMap.TryGetValue(beastData.BeastTypeId, out suit); //神兽名字 string beastName = string.IsNullOrEmpty(beastList.NickName) ? "" : ("-" + beastList.NickName); //神兽皮肤名字 string beastNickname = (suit == null) ? beastList.Name : suit.Name; item.SetText("Label_Beast_Name", string.Format("{0}{1}", beastNickname, beastName)); //设置神兽皮肤 IXUIPicture beastSkin = item.GetUIObject("Picture_Beast_Skin") as IXUIPicture; if (beastSkin != null) { beastSkin.SetVisible(true); beastSkin.SetTexture(string.Format("Texture/Beast/{0}", (suit == null) ? beastList.ModelFile : suit.PicName)); } } else { item.SetVisible(false); } item.Id = playerData.PlayerId; item.SetVisible(true); } }
/// <summary> /// 显示神兽的信息 /// </summary> /// <param name="unBeastTypeId"></param> public void ShowBeastInfo(int unBeastTypeId) { if (base.Prepared) { DataBeastlist data = null; GameData <DataBeastlist> .dataMap.TryGetValue(unBeastTypeId, out data); this.ShowBeastBaseInfo(data, unBeastTypeId); } }
public Beast(BeastData beastData) { if (null == beastData) { this.m_bIsErrorBeast = true; this.m_skillManager = new SkillGameManager(0); } else { this.m_bIsErrorBeast = false; DataBeastlist dataBeast = null; GameData <DataBeastlist> .dataMap.TryGetValue(beastData.BeastTypeId, out dataBeast); if (dataBeast != null) { this.MaxMoveDis = dataBeast.Move; this.Hp = dataBeast.Hp; if (dataBeast.Skill_1 > 0) { this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_1); } if (dataBeast.Skill_2 > 0) { this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_2); } if (dataBeast.Skill_3 > 0) { this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_3); } if (dataBeast.Skill_4 > 0) { this.m_listBeastOriginActivedSkillID.Add(dataBeast.Skill_4); } } else { this.m_log.Error(string.Format("null == beastConfig: beastData.BeastTypeId=:{0}", beastData.BeastTypeId)); } this.m_unBeastId = beastData.Id; this.m_unPlayerId = beastData.PlayerId; this.m_dwBeastTypeId = beastData.BeastTypeId; this.m_eCampType = beastData.CampType; this.m_unHp = beastData.Hp; this.m_suitId = beastData.SuitId; this.m_skillManager = new SkillGameManager(this.m_unBeastId); this.m_skillManager.AddSkill(1, false); foreach (var skillData in beastData.Skills) { this.m_skillManager.AddSkill(skillData, false, ESkillActivateType.SKILL_ACTIVATE_TYPE_INVALID); } } }
public float GetDuration() { Beast beast = Singleton <BeastManager> .singleton.GetBeastById(this.BeAttackId); DataBeastlist data = GameData <DataBeastlist> .dataMap[beast.BeastTypeId]; float time = 0; if (beast != null && data != null) { time = data.DeadFadeout + data.DeadDelay; } return(Mathf.Max(time, beast.GetAnimPlayTime("dead"))); }
/// <summary> /// 根据神兽ID取得神兽对应的头像Icon /// </summary> /// <param name="beastId"></param> /// <returns></returns> public string GetBeastIcon(long beastId) { BeastData beastData = this.GetBeastData(beastId); string result = string.Empty; if (beastData != null) { DataBeastlist beastList = GameData <DataBeastlist> .dataMap[beastData.BeastTypeId]; if (beastList != null) { result = beastList.IconFile; } } return(result); }
private void RefreshPlayerInfo(IXUIListItem item, BeastData beast) { //DataBeastlist dataBeast = GameData<DataBeastlist>.dataMap[beast.BeastTypeId]; DataBeastlist dataBeast = null; GameData <DataBeastlist> .dataMap.TryGetValue(beast.BeastTypeId, out dataBeast); IXUISprite icon = item.GetUIObject("Sprite_Icon") as IXUISprite; if (dataBeast != null) { //如果是自己的阵营,就显示头像。地方就显示随机头像 if (beast.CampType == Singleton <PlayerRole> .singleton.CampType) { icon.SetSprite(dataBeast.IconFile, UIManager.singleton.GetAtlasName(EnumAtlasType.Beast, dataBeast.IconFile)); } else { //icon.SetSprite("Window"); icon.SetSprite(dataBeast.IconFile, UIManager.singleton.GetAtlasName(EnumAtlasType.Beast, dataBeast.IconFile)); } } else { if (beast.BeastTypeId == this.m_unRandomBeastID) { icon.SetSprite("9"); } } bool visible = Singleton <RoomManager> .singleton.IsObserver || Singleton <PlayerRole> .singleton.CampType == beast.CampType; IXUIList equipList = item.GetUIObject("List_Equip") as IXUIList; if (equipList != null) { } else { XLog.Log.Error("null == uiListEquip"); } this.RefreshItemEnable(item, beast.Id); IXUIObject uiObject = item.GetUIObject("Texture_Shadow"); if (uiObject != null) { uiObject.SetVisible(false); } item.Id = beast.Id; }
public void ConfirmBeast(long beastId) { PlayerData playerData = this.GetPlayerData(beastId); BeastData beastData = this.GetBeastData(beastId); if (playerData != null && beastData != null) { DataBeastlist dataList = null; GameData <DataBeastlist> .dataMap.TryGetValue(beastData.BeastTypeId, out dataList); if (dataList != null) { DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.OnRecvChat(playerData.Name, dataList.Name, dataList.NickName, beastData.IsRandom, playerData.CampType); DlgBase <DlgRoom, DlgRoomBehaviour> .singleton.ShowCampTypeEffect(beastId); } } }
public void OnDeadAction() { if (this.m_beastBehaviour != null) { this.m_beastBehaviour.OnDead(); } DataBeastlist data = GameData <DataBeastlist> .dataMap[this.BeastTypeId]; if (data != null) { ActDeadWork work = new ActDeadWork(this.Id, data.DeadDelay, data.DeadFadeoutDepth, data.DeadFadeout, data.DeadEffect); float delayTime = data.DeadFadeout + data.DeadDelay; delayTime = Math.Max(this.GetAnimPlayTime("dead"), delayTime); work.LifeTime = delayTime; this.m_actWorkManager.AddWork(work); } //下面停止buff特效,然后播放基地扣血 }
private void ShowAllSkill(int beastId) { DataBeastlist data = null; GameData <DataBeastlist> .dataMap.TryGetValue(beastId, out data); if (data == null) { //清除技能 } else { List <int> skillList = new List <int>(); skillList.Add(data.Skill_1); skillList.Add(data.Skill_2); skillList.Add(data.Skill_3); skillList.Add(data.Skill_4); } }
/// <summary> /// 根据神兽id和皮肤id,获取源模型路径,如果该模型没有皮肤,就返回原始模型 /// </summary> /// <param name="nSuitId"></param> /// <param name="nBeastTypeId"></param> /// <returns></returns> public static string GetBasePath(int nSuitId, int nBeastTypeId) { string result = string.Empty; //DataSuit dataByID = DataSuitManager.Instance.GetDataByID(nSuitId); DataSuit dataByID = GameData <DataSuit> .dataMap[nSuitId]; if (dataByID != null && !string.IsNullOrEmpty(dataByID.BasePath)) { result = string.Format("Data/Model/BeastModel/{0}", dataByID.BasePath); } else { // DataBeastlist dataById = DataBeastlistManager.Instance.GetDataById(nBeastTypeId); DataBeastlist dataById = GameData <DataBeastlist> .dataMap[nBeastTypeId]; if (null != dataById) { result = string.Format("Data/Model/BeastModel/{0}/{1}", dataById.ModelFile, dataById.ModelFile); } } return(result); }
/// <summary> /// 显示神兽基础信息 /// </summary> /// <param name="data"></param> private void ShowBeastBaseInfo(DataBeastlist data, int unBeastTypeId) { }
/// <summary> /// 显示普通模式的选择神兽列表 /// </summary> private void ShowNormalBeasts() { if (base.Prepared) { bool isShowFreeBeast = Singleton <RoomManager> .singleton.IsShowFreeBeast; this.m_listActiveBeastId.Clear(); List <DataBeastBook> data = GameData <DataBeastBook> .dataMap.Values.ToList <DataBeastBook>(); int index = 1; int j = 0; while (j < data.Count) { int beastId = data[j].BeastId; if (Singleton <RoomManager> .singleton.IsObserver || Singleton <PlayerRole> .singleton.IsBeastActive(beastId, false, isShowFreeBeast)) { IXUIListItem item; if (index < base.uiBehaviour.m_BeastList.Count) { item = base.uiBehaviour.m_BeastList.GetItemByIndex(index); } else { item = base.uiBehaviour.m_BeastList.AddListItem(); } if (item != null) { DataBeastlist dataBeastList = GameData <DataBeastlist> .dataMap[beastId]; if (dataBeastList != null) { IXUISprite sprite = item.GetUIObject("Week") as IXUISprite; if (sprite != null) { bool flag = Singleton <PlayerRole> .singleton.IsFreeBeast(beastId); sprite.SetVisible(flag && isShowFreeBeast); if (flag) { sprite.SetSprite("10"); } } item.SetVisible(true); IXUISprite icon = item.GetUIObject("Icon") as IXUISprite; icon.SetSprite(dataBeastList.IconFile, UIManager.singleton.GetAtlasName(EnumAtlasType.Beast, dataBeastList.IconFile)); item.TipParam = new TipParam { Tip = dataBeastList.Name }; item.Id = (long)dataBeastList.ID; item.RegisterMouseOnEventHandler(new MouseOnEventHandler(this.BeastListMouseOn)); this.m_listActiveBeastId.Add(beastId); } else { item.SetVisible(false); } index++; } } j++; } //是否神兽列表多余,就隐藏 while (index < base.uiBehaviour.m_BeastList.Count) { IXUIListItem item = base.uiBehaviour.m_BeastList.GetItemByIndex(index); item.SetVisible(false); index++; } } }