From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/UI/XTeamInvitedListView.cs | 191 +++++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/XTeamInvitedListView.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/XTeamInvitedListView.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/XTeamInvitedListView.cs b/Client/Assets/Scripts/XMainClient/UI/XTeamInvitedListView.cs new file mode 100644 index 00000000..de7df880 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/XTeamInvitedListView.cs @@ -0,0 +1,191 @@ +using System; +using System.Collections.Generic; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + internal class XTeamInvitedListView : DlgBase + { + public override string fileName + { + get + { + return "Team/InviteListDlg"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + public override int group + { + get + { + return 1; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + public override bool pushstack + { + get + { + return true; + } + } + + private XTeamInviteDocument doc; + + private uint m_TimerID = 0u; + + protected override void Init() + { + this.doc = XDocuments.GetSpecificDocument(XTeamInviteDocument.uuID); + this.doc.InvitedView = this; + } + + protected override void OnUnload() + { + XSingleton.singleton.KillTimer(this.m_TimerID); + this.doc.InvitedView = null; + base.OnUnload(); + } + + public override void RegisterEvent() + { + base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCloseBtnClick)); + base.uiBehaviour.m_BtnIgnore.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnIgnoreBtnClick)); + base.uiBehaviour.m_BtnDeny.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnDenyBtnClick)); + base.uiBehaviour.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentItemUpdated)); + } + + protected override void OnShow() + { + base.OnShow(); + XSingleton.singleton.KillTimer(this.m_TimerID); + this._AutoRefresh(null); + } + + protected override void OnHide() + { + base.OnHide(); + XSingleton.singleton.KillTimer(this.m_TimerID); + } + + public override void StackRefresh() + { + XSingleton.singleton.KillTimer(this.m_TimerID); + this._AutoRefresh(null); + } + + private void _AutoRefresh(object param) + { + bool flag = base.IsVisible(); + if (flag) + { + this.doc.ReqInvitedList(); + this.m_TimerID = XSingleton.singleton.SetTimer(3f, new XTimerMgr.ElapsedEventHandler(this._AutoRefresh), null); + } + } + + public void RefreshPage() + { + List invitedList = this.doc.InvitedList; + base.uiBehaviour.m_WrapContent.SetContentCount(invitedList.Count, false); + base.uiBehaviour.m_NoInvitation.SetActive(invitedList.Count == 0); + } + + private void WrapContentItemUpdated(Transform t, int index) + { + List invitedList = this.doc.InvitedList; + bool flag = index >= invitedList.Count; + if (flag) + { + XSingleton.singleton.AddErrorLog("Item index out of range: ", index.ToString(), null, null, null, null); + } + else + { + XTeamInviteData xteamInviteData = invitedList[index]; + IXUILabel ixuilabel = t.Find("DungeonName").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel2 = t.Find("Name").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel3 = t.Find("PPT").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel4 = t.Find("Time").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel5 = t.Find("MemberCount").GetComponent("XUILabel") as IXUILabel; + GameObject gameObject = t.Find("RewardHunt").gameObject; + IXUISprite ixuisprite = t.Find("Regression").GetComponent("XUISprite") as IXUISprite; + IXUIButton ixuibutton = t.Find("BtnJoin").GetComponent("XUIButton") as IXUIButton; + ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnJoinBtnClick)); + bool flag2 = xteamInviteData.briefData.rift != null; + if (flag2) + { + ixuilabel.SetText(xteamInviteData.briefData.rift.GetSceneName(xteamInviteData.briefData.dungeonName)); + } + else + { + ixuilabel.SetText(xteamInviteData.briefData.dungeonName); + } + ixuilabel2.SetText(xteamInviteData.invitorName); + ixuilabel3.SetText(xteamInviteData.briefData.GetStrTeamPPT(0.0)); + ixuilabel4.SetText(XSingleton.singleton.TimeAgoFormatString((int)xteamInviteData.time)); + ixuilabel5.SetText(string.Format("{0}/{1}", xteamInviteData.briefData.currentMemberCount, xteamInviteData.briefData.totalMemberCount)); + ixuisprite.SetVisible(xteamInviteData.briefData.regression); + xteamInviteData.briefData.goldGroup.SetUI(gameObject, true); + XTeamView.SetTeamRelationUI(t.Find("Relation"), xteamInviteData.invitorRelation, false, XTeamRelation.Relation.TR_NONE); + ixuibutton.ID = (ulong)((long)index); + } + } + + private bool _OnCloseBtnClick(IXUIButton go) + { + this.SetVisibleWithAnimation(false, null); + return true; + } + + private bool _OnIgnoreBtnClick(IXUIButton go) + { + this.doc.ReqIgnoreAll(); + this.SetVisibleWithAnimation(false, null); + return true; + } + + private bool _OnDenyBtnClick(IXUIButton go) + { + this.doc.ReqDeny(); + this.SetVisibleWithAnimation(false, null); + return true; + } + + private bool _OnJoinBtnClick(IXUIButton go) + { + int num = (int)go.ID; + bool flag = num >= this.doc.InvitedList.Count; + bool result; + if (flag) + { + result = true; + } + else + { + XTeamInviteData xteamInviteData = this.doc.InvitedList[num]; + this.doc.ReqTeamInviteAck(true, xteamInviteData.inviteID); + result = true; + } + return result; + } + } +} -- cgit v1.1-26-g67d0