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 roleContainerList = 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.GetDressUpPath("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); Vector2 localpos = obj.position;//.LocalToGlobal(); itemObj.m_btnDetail.data = localpos; itemObj.m_btnDetail.onClick.Add(OnBtnDetailClick); itemObj.m_iconRole.data = index; itemObj.m_iconRole.onClick.Add(OnBtnIconRoleClick); itemObj.m_txtRoleName.text = teapartyRoleCfg[index].name; //itemObj.m_txtMaxValue.text = roleContainerList[index].MaxScore.ToString(); //itemObj.m_txtNumber.text = roleContainerList[index].PerNum.ToString(); //itemObj.m_txtMaxName.text = roleContainerList[index].MaxScoreROleName.ToString(); UI_comTeaPartyItem.ProxyEnd(); } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); var openCfg = TeapartyOpenCfgArray.Instance.GetCfg(1);//LeagueDataManager.Instance.TeaPartyId _ui.m_txtTeaName.text = openCfg.name; _ui.m_teaPartyItemTips.target.visible = false; int myPos = LeagueDataManager.Instance.GetMyPos(); bool isLeader = myPos == LeaguePos.Owner || myPos == LeaguePos.SubOwner; _ui.m_btnChallenge.visible = isLeader; UpDataOverTime(); //GetRoleContainerInfos(); roleContainerList = LeagueDataManager.Instance.RoleContainerList; _ui.m_ListTeaParty.numItems = 6; } private void UpDataOverTime() { //_ui.m_txtOverTime.text = "挑战剩余时间:" + TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].EndTime); } private async void GetRoleContainerInfos() { bool result = await LeagueSproxy.GetRoleContainerInfos(); if (result) { roleContainerList = LeagueDataManager.Instance.RoleContainerList; _ui.m_ListTeaParty.numItems = 6; } } protected override void OnHide() { base.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void OnBtnChatClick() { ViewManager.Show(); } private void OnBtnChallengeClick() { string stroyStartID = "50001"; ViewManager.Show(new object[] { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog),null,true }, null, true); //ViewManager.Show(); } private static void OnCompletePriorStoryDialog(bool isSkip, object param) { ViewManager.Show(); } private void OnBtnRewardClick() { ViewManager.Show(); } private void OnBtnBackClick() { ViewManager.GoBackFrom(typeof(LeagueView).FullName); } private void OnBtnDetailClick(EventContext context) { GObject obj = context.sender as GObject; var pos = (Vector2)obj.data; //_ui.m_teaPartyItemTips.m_window.position = pos; _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); } } }