/// <summary> /// 获取小队英雄 /// </summary> /// <param name="obj"></param> void OnGetHeroTeamInfo(object obj) { if (HeroTeamMediator.heroTeamMediator != null) { HeroListMsg info = (HeroListMsg)obj; HeroTeamMediator.heroTeamMediator.UpdateTeamInfo(info); return; } Facade.SendNotification(NotificationID.HeroTeamOpen, obj); }
/// <summary> /// 刷新小队信息 /// </summary> /// <param name="info"></param> public void UpdateTeamInfo(HeroListMsg info) { heroList.Clear(); heroListMsg = info; info.heroList.Sort((x, y) => y.pos.CompareTo(x.pos)); panel.teamName.text = info.teamName; List <int> pos = new List <int> { 1, 2, 3, 4 }; for (int i = 0; i < info.heroList.Count; ++i) { if (info.heroList[i].pos == 0) { continue; } HeroInfo infos = new HeroInfo { heroUUId = info.heroList[i].heroUUId, configId = info.heroList[i].configId, pos = info.heroList[i].pos, arcaneId = info.heroList[i].arcaneId, cardTeamName = info.heroList[i].cardTeamName, }; pos.Remove(info.heroList[i].pos); heroList.Add(infos); } for (int i = 0; i < pos.Count; ++i) { HeroInfo infos = new HeroInfo { heroUUId = 0, pos = pos[i], }; heroList.Add(infos); } heroList.Sort((x, y) => x.pos.CompareTo(y.pos)); panel.heroGrid.AddCustomDataList(AddGridDataList(4, heroList)); panel.cardGrid.AddCustomDataList(AddGridDataList(8, info.heroList)); }
/// <summary> /// 界面显示调用 /// </summary> protected override void OnShow(INotification notification) { heroListMsg = (HeroListMsg)notification.Body; UpdateTeamInfo(heroListMsg); }