/// <summary> /// 初始化队伍Btn组 /// </summary> /// <param name="teamBtns"></param> /// <param name="m_TeamBtnList"></param> private void InitBtnShow(Transform teamBtns, List <UI_LookHeroClick> m_TeamBtnList) { m_TeamBtnList.Clear(); for (int i = 0; i < teamBtns.childCount; i++) { OtherHeroInfo _info = null; m_HeroAttribute.TryGetValue((i + 1), out _info); UI_LookHeroClick _lookItem = teamBtns.GetChild(i).GetComponent <UI_LookHeroClick>(); if (_info == null) { continue; } _lookItem.m_HeroId = _info.m_HeroId; _lookItem.m_Exp = _info.m_Exp; _lookItem.m_HeroLevel = _info.m_HeroLevel; _lookItem.m_Hp = _info.m_Hp; _lookItem.m_PysicalAttack = _info.m_PysicalAttack; _lookItem.m_Physicaldefence = _info.m_Physicaldefence; _lookItem.m_MagicAttack = _info.m_MagicAttack; _lookItem.m_MagicDefence = _info.m_MagicDefence; _lookItem.m_Skill1 = _info.m_Skill1; _lookItem.m_Skill2 = _info.m_Skill2; _lookItem.m_Skill3 = _info.m_Skill3; _lookItem.m_HeroViewId = _info.m_HeroViewId; _lookItem.InitShowUI(); m_TeamBtnList.Add(_lookItem); } }
public Dictionary <int, OtherHeroInfo> m_HeroAttribute = new Dictionary <int, OtherHeroInfo>(); // 使用英雄的位置和属性信息(key为位置,value为OtherHero属性信息) public void Copy(EndlessRankInfo _data) { this.m_RoleId = _data.roleid; this.m_RoleName = _data.rolename; this.m_Level = _data.level; this.m_GroupNum = _data.groupnum; this.m_TroopType = _data.trooptype; this.m_AlldropNum = _data.alldropnum; this.m_OnRankNum = _data.onranknum; foreach (DictionaryEntry kvp in _data.heroattribute) { OtherHeroInfo _other = new OtherHeroInfo(); _other.Copy(kvp.Value as OtherHero); m_HeroAttribute.Add((int)kvp.Key, _other); } }
/// <summary> /// 设置显示队伍 /// </summary> /// <param name="teamPos"></param> private void SetShowTram(Transform teamPos) { ClearTramModel(); for (int i = 0; i < teamPos.childCount; i++) { OtherHeroInfo _info = null; bool isNull = m_HeroAttribute.TryGetValue((i + 1), out _info); if (isNull == false) { continue; } int _artResId = _info.m_HeroViewId; ArtresourceTemplate _artRes = (ArtresourceTemplate)DataTemplate.GetInstance().m_ArtresourceTable.getTableData(_artResId); GameObject _assetRes = AssetLoader.Inst.GetAssetRes(_artRes.getArtresources()); GameObject _go = Instantiate(_assetRes, teamPos.GetChild(i).position, teamPos.GetChild(i).rotation) as GameObject; if (_go != null) { float _zoom = _artRes.getArtresources_zoom(); _go.transform.localScale = new Vector3(_zoom, _zoom, _zoom); Animation _anim = _go.GetComponent <Animation>(); if (_anim != null) { if (_go.GetComponent <Animation>()["Idle1"] != null) { _go.GetComponent <Animation>().CrossFade("Idle1"); } else if (_go.GetComponent <Animation>()["Nidle1"] != null) { _go.GetComponent <Animation>().CrossFade("Nidle1"); } _go.GetComponent <Animation>().wrapMode = WrapMode.Loop; } } m_GoList.Add(_go); } }