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/YorozuyaDlg.cs | 153 +++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/YorozuyaDlg.cs (limited to 'Client/Assets/Scripts/XMainClient/YorozuyaDlg.cs') diff --git a/Client/Assets/Scripts/XMainClient/YorozuyaDlg.cs b/Client/Assets/Scripts/XMainClient/YorozuyaDlg.cs new file mode 100644 index 00000000..4362e5e1 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/YorozuyaDlg.cs @@ -0,0 +1,153 @@ +using System; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class YorozuyaDlg : DlgBase + { + public override string fileName + { + get + { + return "GameSystem/YorozuyaDlg"; + } + } + + public override int layer + { + get + { + return 1; + } + } + + 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; + } + } + + public override int sysid + { + get + { + return 440; + } + } + + private XYorozuyaDocument m_doc; + + protected override void OnLoad() + { + base.OnLoad(); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + base.uiBehaviour.m_closedBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickClosedBtn)); + } + + protected override void OnUnload() + { + base.OnUnload(); + } + + protected override void Init() + { + base.Init(); + this.m_doc = XYorozuyaDocument.Doc; + } + + protected override void OnHide() + { + base.OnHide(); + XSingleton.singleton.Freezed = false; + } + + protected override void OnShow() + { + base.OnShow(); + this.FillContent(); + } + + private void FillContent() + { + base.uiBehaviour.m_itemPool.ReturnAll(true); + for (int i = 0; i < this.m_doc.YorozuyaTab.Table.Length; i++) + { + YorozuyaTable.RowData rowData = this.m_doc.YorozuyaTab.Table[i]; + bool flag = rowData == null; + if (!flag) + { + GameObject gameObject = base.uiBehaviour.m_itemPool.FetchGameObject(false); + gameObject.transform.parent = base.uiBehaviour.m_parentTra; + gameObject.transform.localScale = Vector3.one; + gameObject.transform.localPosition = base.uiBehaviour.m_itemPool.TplPos + new Vector3((float)(i % 3 * base.uiBehaviour.m_itemPool.TplWidth), (float)(-(float)(i / 3) * base.uiBehaviour.m_itemPool.TplHeight), 0f); + IXUISprite ixuisprite = gameObject.transform.GetComponent("XUISprite") as IXUISprite; + ixuisprite.ID = (ulong)rowData.ID; + ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickIcon)); + IXUILabel ixuilabel = gameObject.transform.Find("shopname").GetComponent("XUILabel") as IXUILabel; + ixuilabel.SetText(rowData.Name); + IXUITexture ixuitexture = gameObject.transform.Find("Icon").GetComponent("XUITexture") as IXUITexture; + ixuitexture.SetTexturePath(rowData.IconName); + ixuitexture.SetEnabled(rowData.IsOpen == 0); + } + } + } + + private bool OnClickClosedBtn(IXUIButton btn) + { + this.SetVisibleWithAnimation(false, null); + return true; + } + + private void OnClickIcon(IXUISprite spr) + { + YorozuyaTable.RowData rowData = this.m_doc.GetRowData((byte)spr.ID); + bool flag = rowData == null; + if (!flag) + { + bool flag2 = rowData.IsOpen == 1; + if (flag2) + { + XSingleton.singleton.ShowSystemTip(XSingleton.singleton.GetString("ERR_CUSTOM_NOTOPEN"), "fece00"); + } + else + { + this.m_doc.ReqEnterScene((int)spr.ID); + } + } + } + } +} -- cgit v1.1-26-g67d0