From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/UI/RequestDlg.cs | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/RequestDlg.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/RequestDlg.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/RequestDlg.cs b/Client/Assets/Scripts/XMainClient/UI/RequestDlg.cs new file mode 100644 index 00000000..9f507bb3 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/RequestDlg.cs @@ -0,0 +1,114 @@ +using System; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + internal class RequestDlg : DlgBase + { + public override bool autoload + { + get + { + return true; + } + } + + public override string fileName + { + get + { + return "Guild/GuildCollect/RequestDlg"; + } + } + + private XRequestDocument _doc; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XRequestDocument.uuID); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseBtnClick)); + base.uiBehaviour.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.DesWrapListUpdated)); + base.uiBehaviour.m_ClearBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClearBtnClick)); + } + + protected override void OnShow() + { + base.OnShow(); + this._doc.QueryRequestList(); + } + + protected override void OnHide() + { + base.OnHide(); + } + + protected override void OnUnload() + { + base.OnUnload(); + } + + public void Refresh(bool resetScrollPos = true) + { + base.uiBehaviour.m_WrapContent.SetContentCount(this._doc.List.Count, false); + if (resetScrollPos) + { + base.uiBehaviour.m_ScrollView.ResetPosition(); + } + } + + private void DesWrapListUpdated(Transform t, int index) + { + PartyExchangeItemInfo partyExchangeItemInfo = this._doc.List[index]; + IXUISprite ixuisprite = t.Find("Head").GetComponent("XUISprite") as IXUISprite; + IXUILabel ixuilabel = t.Find("Name").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel2 = t.Find("Level").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel3 = t.Find("Prof").GetComponent("XUILabel") as IXUILabel; + IXUILabel ixuilabel4 = t.Find("Time").GetComponent("XUILabel") as IXUILabel; + IXUIButton ixuibutton = t.Find("YesBtn").GetComponent("XUIButton") as IXUIButton; + IXUIButton ixuibutton2 = t.Find("NoBtn").GetComponent("XUIButton") as IXUIButton; + ixuisprite.spriteName = XSingleton.singleton.GetProfHeadIcon((int)partyExchangeItemInfo.profession_id); + ixuilabel.SetText(partyExchangeItemInfo.name); + ixuilabel2.SetText(partyExchangeItemInfo.level.ToString()); + ixuilabel3.SetText(XSingleton.singleton.GetProfName((int)partyExchangeItemInfo.profession_id)); + ixuilabel4.SetText(XSingleton.singleton.TimeAccFormatString((int)partyExchangeItemInfo.time, 3, 0) + XStringDefineProxy.GetString("AGO")); + ixuibutton.ID = partyExchangeItemInfo.role_id; + ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnYesBtnClick)); + ixuibutton2.ID = partyExchangeItemInfo.role_id; + ixuibutton2.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnNoBtnClick)); + } + + private bool OnCloseBtnClick(IXUIButton btn) + { + this.SetVisibleWithAnimation(false, null); + return true; + } + + private bool OnClearBtnClick(IXUIButton btn) + { + this._doc.ClearList(); + return true; + } + + private bool OnYesBtnClick(IXUIButton btn) + { + this._doc.QueryAcceptExchange(btn.ID); + return true; + } + + private bool OnNoBtnClick(IXUIButton btn) + { + this._doc.QueryRefuseExchange(btn.ID); + return true; + } + } +} -- cgit v1.1-26-g67d0