using ET; using FairyGUI; using Hutool; using System.Collections.Generic; using UI.League; using UnityEngine; namespace GFGGame { public class LeagueTeaPartyShowView : BaseWindow { private UI_LeagueTeaPartyShowUI _ui; private List teaPartyOverItemList = new List(); private List teapartyRoleCfg; private int timeIndex = 3; //定时器时间计算 public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_LeagueTeaPartyShowUI.PACKAGE_NAME; _ui = UI_LeagueTeaPartyShowUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_loaBg.url = ResPathUtil.GetDressUpPath("chahuibg"); _ui.m_btnBack.onClick.Add(OnBtnBackClick); teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem1); teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem2); teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem3); teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem4); teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem5); teaPartyOverItemList.Add(_ui.m_TeaPartyOverItem6); teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(1); //LeagueDataManager.Instance.TeaPartyId } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); timeIndex = 3; _ui.m_txtCountdown.text = string.Format("将在[color=#FF6600]{0}s[/color]后进入下一阶段", timeIndex); GetRoleContainerInfos(); Timers.inst.Add(1, 3, UpdateTime); } protected override void OnHide() { base.OnHide(); Timers.inst.Remove(UpdateTime); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private async void GetRoleContainerInfos() { bool result = await LeagueSproxy.GetRoleContainerInfos(RoleDataManager.roleId); if (result) { var roleContainerList = LeagueDataManager.Instance.RoleContainerList; for (int index = 0; index < teaPartyOverItemList.Count; index++) { teaPartyOverItemList[index].m_txtRoleName.text = teapartyRoleCfg[index].name; teaPartyOverItemList[index].m_txtGuildName.text = roleContainerList[index].MaxScoreRoleName; } } } private void OnBtnBackClick() { ViewManager.GoBackFrom(typeof(LeagueTeaPartyShowView).FullName); } private void openNextView() { string stroyStartID = "50001"; ViewManager.Show(new object[] { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog), null, true }, null, true); } private static void OnCompletePriorStoryDialog(bool isSkip, object param) { ViewManager.Show(null, new object[] { typeof(LeagueView).FullName, null }); } private void UpdateTime(object param) { timeIndex -= 1; _ui.m_txtCountdown.text = string.Format("将在[color=#FF6600]{0}s[/color]后进入下一阶段", timeIndex); if (timeIndex <= 0) { openNextView(); Timers.inst.Remove(UpdateTime); } } } }