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/AncientBox.cs | 117 ++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/AncientBox.cs (limited to 'Client/Assets/Scripts/XMainClient/AncientBox.cs') diff --git a/Client/Assets/Scripts/XMainClient/AncientBox.cs b/Client/Assets/Scripts/XMainClient/AncientBox.cs new file mode 100644 index 00000000..041bd1c2 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/AncientBox.cs @@ -0,0 +1,117 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class AncientBox : DlgBase + { + public override string fileName + { + get + { + return "OperatingActivity/AncientBox"; + } + } + + public override bool autoload + { + get + { + return true; + } + } + + public override bool hideMainMenu + { + get + { + return false; + } + } + + public override bool pushstack + { + get + { + return false; + } + } + + public override bool fullscreenui + { + get + { + return true; + } + } + + private AncientTimesTable.RowData row; + + protected override void OnShow() + { + base.OnShow(); + base.uiBehaviour.m_sprRed.SetVisible(false); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + base.uiBehaviour.m_btnClaim.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClick)); + base.uiBehaviour.m_black.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClose)); + } + + public void Show(AncientTimesTable.RowData r) + { + this.row = r; + this.SetVisible(true, true); + this.RefreshPoint(); + this.RefreshRwd(); + } + + private void RefreshPoint() + { + base.uiBehaviour.m_title.SetText(this.row.Title); + base.uiBehaviour.m_point.SetText(XStringDefineProxy.GetString("AncientPoint", new object[] + { + this.row.nPoints[1] + })); + } + + private void RefreshRwd() + { + base.uiBehaviour.m_rwdpool.ReturnAll(false); + int tplWidth = base.uiBehaviour.m_rwdpool.TplWidth; + int i = 0; + int count = (int)this.row.Items.count; + while (i < count) + { + GameObject gameObject = base.uiBehaviour.m_rwdpool.FetchGameObject(false); + XSingleton.singleton.AddChild(base.uiBehaviour.itemTpl.transform.parent.gameObject, gameObject); + XSingleton.singleton.normalItemDrawer.DrawItem(gameObject, (int)this.row.Items[i, 0], (int)this.row.Items[i, 1], false); + Vector3 localPosition = base.uiBehaviour.itemTpl.transform.localPosition; + localPosition.x = (float)((count % 2 == 0) ? ((int)((float)i - (float)count / 2f) * tplWidth + tplWidth / 2) : ((int)((float)i - (float)(count - 1) / 2f) * tplWidth)); + gameObject.transform.localPosition = localPosition; + IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite; + ixuisprite.ID = (ulong)this.row.Items[i, 0]; + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton.singleton.OnItemClick)); + i++; + } + } + + private bool OnClick(IXUIButton btn) + { + XAncientDocument specificDocument = XDocuments.GetSpecificDocument(XAncientDocument.uuID); + specificDocument.ReqPoint(this.row.ID); + return true; + } + + private void OnClose(IXUISprite spr) + { + this.SetVisible(false, true); + } + } +} -- cgit v1.1-26-g67d0