private IEnumerator SetUIIE(UIAllHeroInfoTransfer info) { //第一次载入,创建角色在主界面做,传过来的永远是一样的数量 if (m_HeroViewList == null) { m_HeroViewList = new List <UIHeroView>(); for (int i = 0; i < info.HeroInfoList.Count; i++) { UIHeroView view = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.UIWindowChild, "HeroItem").GetComponent <UIHeroView>(); m_HeroViewList.Add(view); view.transform.SetParent(HeroGrid.transform); view.transform.localScale = Vector3.one; view.transform.localPosition = Vector3.zero; view.ShowHeroInfoEvent += OnShowHeroInfoEventBack; view.HideHeroInfoEvent += OnHideHeroInfoEventBack; view.BeginDragHeroEvent += OnBeginDragHeroEventCallBack; view.UpdateDragHeroEvent += OnUpdateDragHeroEventBack; view.GoFightEvent += OnGoFightCallBack; if (i % 9 == 0) { yield return(null); } } } //再次刷新 for (int i = 0; i < m_HeroViewList.Count; i++) { m_HeroViewList[i].SetUI(HeroScoll, info.HeroInfoList[i].IsFight, info.HeroInfoList[i].RoleId, info.HeroInfoList[i].HeroId, info.HeroInfoList[i].HeroIcon, info.HeroInfoList[i].AttackArea, info.HeroInfoList[i].AttackRange, info.HeroInfoList[i].JobIcon, info.HeroInfoList[i].HeroName); } }
/// <summary> /// 更新我获取的卡牌的状态 /// </summary> public void UpdateAllHeroInfo() { UIAllHeroInfoTransfer t = new UIAllHeroInfoTransfer(); for (int i = 0; i < Global.HeroInfoList.Count; i++) { HeroInfo info = Global.HeroInfoList[i]; if (info == null) { Debug.LogError("错啦,全错啦,菜逼!"); return; } UIAllHeroInfoTransfer.UIHeroInfo uinfo = PrepareUIHeroInfo(info); long roleId = Global.FightHeroList.Find(x => x == Global.HeroInfoList[i].RoleId); if (roleId != 0) { uinfo.IsFight = true; } else { uinfo.IsFight = false; } //配置拥有的所有英雄 t.HeroInfoList.Add(uinfo); } ((UIGameSceneView)UISceneCtrl.Instance.CurrentUIScene).SetUI(t); }
public void SetUI(UIAllHeroInfoTransfer info) { StartCoroutine(SetUIIE(info)); }