From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/WeekEndNestDlg.cs | 190 +++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/WeekEndNestDlg.cs (limited to 'Client/Assets/Scripts/XMainClient/WeekEndNestDlg.cs') diff --git a/Client/Assets/Scripts/XMainClient/WeekEndNestDlg.cs b/Client/Assets/Scripts/XMainClient/WeekEndNestDlg.cs new file mode 100644 index 00000000..ce4d933d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/WeekEndNestDlg.cs @@ -0,0 +1,190 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class WeekEndNestDlg : DlgBase + { + public override string fileName + { + get + { + return "GameSystem/WeekEndNestDlg"; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + public override bool hideMainMenu + { + get + { + return true; + } + } + + public override bool pushstack + { + get + { + return true; + } + } + + public override bool fullscreenui + { + get + { + return true; + } + } + + private WeekEndNestDocument m_doc; + + protected override void OnLoad() + { + base.OnLoad(); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + base.uiBehaviour.m_closedBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClosed)); + base.uiBehaviour.m_helpBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnHelp)); + base.uiBehaviour.m_getBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGeted)); + base.uiBehaviour.m_gotoTeamBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGotoTeam)); + } + + protected override void OnUnload() + { + base.OnUnload(); + } + + protected override void Init() + { + base.Init(); + this.m_doc = WeekEndNestDocument.Doc; + } + + protected override void OnHide() + { + base.OnHide(); + } + + protected override void OnShow() + { + base.OnShow(); + this.FillContent(); + bool needLoginShow = this.m_doc.NeedLoginShow; + if (needLoginShow) + { + this.m_doc.NeedLoginShow = false; + } + } + + public override void StackRefresh() + { + base.StackRefresh(); + } + + public void Refresh() + { + this.FillContent(); + } + + private void FillContent() + { + base.uiBehaviour.m_tittleLab.SetText(this.m_doc.GetLevelName()); + base.uiBehaviour.m_rulesLab.SetText(this.m_doc.GetRules()); + base.uiBehaviour.m_tex.SetTexturePath(this.m_doc.GetTexName()); + base.uiBehaviour.m_timesLab.SetText(string.Format("{0}/{1}", this.m_doc.LeftCount, this.m_doc.MaxCount())); + bool flag = this.m_doc.GetStatus == 1u; + if (flag) + { + base.uiBehaviour.m_getSpr.SetGrey(true); + base.uiBehaviour.m_reddotGo.SetActive(true); + } + else + { + base.uiBehaviour.m_getSpr.SetGrey(false); + base.uiBehaviour.m_reddotGo.SetActive(false); + } + base.uiBehaviour.m_itemPool.ReturnAll(true); + SeqListRef reward = this.m_doc.GetReward(); + for (int i = 0; i < (int)reward.count; i++) + { + GameObject gameObject = base.uiBehaviour.m_itemPool.FetchGameObject(false); + gameObject.name = reward[i, 0].ToString(); + gameObject.transform.parent = base.uiBehaviour.m_parentTra; + gameObject.transform.localPosition = new Vector3((float)(i * base.uiBehaviour.m_itemPool.TplWidth), 0f, 0f); + XSingleton.singleton.normalItemDrawer.DrawItem(gameObject, (int)reward[i, 0], (int)reward[i, 1], false); + IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite; + ixuisprite.ID = (ulong)reward[i, 0]; + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnShowTips)); + } + } + + private bool OnClosed(IXUIButton btn) + { + this.SetVisible(false, true); + return true; + } + + private bool OnHelp(IXUIButton btn) + { + DlgBase.singleton.ShowHelp(XSysDefine.XSys_WeekEndNest); + return true; + } + + private bool OnGeted(IXUIButton btn) + { + bool flag = this.m_doc.GetStatus != 1u; + bool result; + if (flag) + { + result = false; + } + else + { + this.m_doc.ReqGetReward(); + result = true; + } + return result; + } + + private bool OnGotoTeam(IXUIButton btn) + { + int dnId = this.m_doc.GetDnId(); + bool flag = dnId == 0; + bool result; + if (flag) + { + result = false; + } + else + { + XTeamDocument specificDocument = XDocuments.GetSpecificDocument(XTeamDocument.uuID); + specificDocument.SetAndMatch(dnId); + result = true; + } + return result; + } + + private void OnShowTips(IXUISprite spr) + { + int itemID = (int)spr.ID; + XItem mainItem = XBagDocument.MakeXItem(itemID, true); + XSingleton.singleton.ShowTooltipDialogWithSearchingCompare(mainItem, spr, true, 0u); + } + } +} -- cgit v1.1-26-g67d0