using ET; using FairyGUI; using Hutool; using System.Collections.Generic; using UI.League; using UnityEngine; namespace GFGGame { public class LeagueTeaPartyView : BaseWindow { private UI_LeagueTeaPartyUI _ui; private List teaPartyItemList = new List(); private List teapartyRoleCfg; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_LeagueTeaPartyUI.PACKAGE_NAME; _ui = UI_LeagueTeaPartyUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("chahuibg"); _ui.m_btnBack.onClick.Add(OnBtnBackClick); _ui.m_btnChat.onClick.Add(OnBtnChatClick); _ui.m_btnChallenge.onClick.Add(OnBtnChallengeClick); _ui.m_btnReward.onClick.Add(OnBtnRewardClick); _ui.m_teaPartyItemTips.target.onClick.Add(OnTeaPartyItemTipsClick); _ui.m_btnRule.onClick.Add(RuleController.ShowRuleView); _ui.m_btnRule.data = 300022; _ui.m_ListTeaParty.itemRenderer = ListTeaPartyItemRender; teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(1); //LeagueDataManager.Instance.TeaPartyId } private void ListTeaPartyItemRender(int index, GObject obj) { UI_comTeaPartyItem itemObj = UI_comTeaPartyItem.Proxy(obj); itemObj.m_btnDetail.onClick.Add(OnBtnDetailClick); itemObj.m_iconRole.data = index; itemObj.m_iconRole.onClick.Add(OnBtnIconRoleClick); itemObj.m_txtRoleName.text = teapartyRoleCfg[index].name; UI_comTeaPartyItem.ProxyEnd(); } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); GetRoleContainerInfos(); var openCfg = TeapartyOpenCfgArray.Instance.GetCfg(1);//LeagueDataManager.Instance.TeaPartyId _ui.m_txtTeaName.text = openCfg.name; _ui.m_teaPartyItemTips.target.visible = false; _ui.m_ListTeaParty.numItems = 6; } private async void GetRoleContainerInfos() { bool result = await LeagueSproxy.GetRoleContainerInfos(); if (result) { var roleContainerList = LeagueDataManager.Instance.RoleContainerList; for (int index = 0; index < roleContainerList.Count; index++){ teaPartyItemList[index].m_txtMaxValue.text = roleContainerList[index].MaxScore.ToString(); } } } protected override void OnHide() { base.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void OnBtnChatClick() { ViewManager.Show(); } private void OnBtnChallengeClick() { PromptController.Instance.ShowFloatTextPrompt("开始挑战"); ViewManager.Show(); } private void OnBtnRewardClick() { ViewManager.Show(); } private void OnBtnBackClick() { ViewManager.GoBackFrom(typeof(LeagueView).FullName); } private void OnBtnDetailClick() { _ui.m_teaPartyItemTips.target.visible = true; } private void OnTeaPartyItemTipsClick() { _ui.m_teaPartyItemTips.target.visible = false; } private void OnBtnIconRoleClick(EventContext context) { GObject obj = context.sender as GObject; LeagueDataManager.Instance.ChooseTeaPartId = (int)obj.data + 1; DressUpFightType dressUpFightType = new DressUpFightType(); dressUpFightType.levelID = 0; dressUpFightType.teaPartID = LeagueDataManager.Instance.ChooseTeaPartId; ViewManager.Show(dressUpFightType, new object[] { typeof(LeagueTeaPartyView).FullName, null }, true); } } }