From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/ForgeSuccessHandler.cs | 123 +++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/ForgeSuccessHandler.cs (limited to 'Client/Assets/Scripts/XMainClient/ForgeSuccessHandler.cs') diff --git a/Client/Assets/Scripts/XMainClient/ForgeSuccessHandler.cs b/Client/Assets/Scripts/XMainClient/ForgeSuccessHandler.cs new file mode 100644 index 00000000..2217323f --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/ForgeSuccessHandler.cs @@ -0,0 +1,123 @@ +using System; +using UILib; +using UnityEngine; + +namespace XMainClient +{ + internal class ForgeSuccessHandler : DlgHandlerBase + { + private XForgeDocument m_doc; + + private IXUISprite m_closeBtn; + + private IXUIButton m_gotoBtn; + + private IXUILabel m_attrNameLab; + + private IXUILabel m_attrValueLab; + + private IXUISprite m_checkBoxSpr; + + protected override void Init() + { + base.Init(); + this.m_doc = XForgeDocument.Doc; + this.m_closeBtn = (base.PanelObject.transform.Find("Bg/Close").GetComponent("XUISprite") as IXUISprite); + this.m_gotoBtn = (base.PanelObject.transform.Find("Bg/GotoBtn").GetComponent("XUIButton") as IXUIButton); + this.m_checkBoxSpr = (base.PanelObject.transform.Find("Bg/Toggle").GetComponent("XUISprite") as IXUISprite); + Transform transform = base.PanelObject.transform.Find("Bg/AttrItem"); + this.m_attrNameLab = (transform.Find("Name").GetComponent("XUILabel") as IXUILabel); + this.m_attrValueLab = (transform.Find("NowValue").GetComponent("XUILabel") as IXUILabel); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this.m_closeBtn.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnCloseClicked)); + this.m_gotoBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGotoClicked)); + this.m_checkBoxSpr.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickToggle)); + } + + protected override void OnShow() + { + base.OnShow(); + this.FillContent(); + } + + protected override void OnHide() + { + base.OnHide(); + } + + public override void OnUnload() + { + base.OnUnload(); + } + + private void FillContent() + { + GameObject gameObject = this.m_checkBoxSpr.transform.Find("selected").gameObject; + bool isShowTips = this.m_doc.IsShowTips; + if (isShowTips) + { + gameObject.SetActive(false); + this.m_checkBoxSpr.ID = 0UL; + } + else + { + gameObject.SetActive(true); + this.m_checkBoxSpr.ID = 1UL; + } + XItem itemByUID = XBagDocument.BagDoc.GetItemByUID(this.m_doc.CurUid); + bool flag = itemByUID == null; + if (!flag) + { + XEquipItem xequipItem = itemByUID as XEquipItem; + bool flag2 = xequipItem.forgeAttrInfo.ForgeAttr.Count == 0; + if (!flag2) + { + EquipSlotAttrDatas attrData = XForgeDocument.ForgeAttrMgr.GetAttrData((uint)itemByUID.itemID); + bool flag3 = attrData == null; + if (!flag3) + { + string color = attrData.GetColor(1, xequipItem.forgeAttrInfo.ForgeAttr[0]); + string text = string.Format("[{0}]{1}[-]", color, XAttributeCommon.GetAttrStr((int)xequipItem.forgeAttrInfo.ForgeAttr[0].AttrID)); + this.m_attrNameLab.SetText(text); + text = string.Format("[{0}]{1}[-]", color, xequipItem.forgeAttrInfo.ForgeAttr[0].AttrValue); + this.m_attrValueLab.SetText(text); + } + } + } + } + + private void OnCloseClicked(IXUISprite spr) + { + base.SetVisible(false); + } + + private bool OnGotoClicked(IXUIButton btn) + { + base.SetVisible(false); + XSmeltDocument.Doc.SelectEquip(this.m_doc.CurUid); + return true; + } + + private void OnClickToggle(IXUISprite spr) + { + GameObject gameObject = spr.transform.Find("selected").gameObject; + bool flag = spr.ID == 0UL; + if (flag) + { + spr.ID = 1UL; + gameObject.SetActive(true); + this.m_doc.IsShowTips = false; + } + else + { + spr.ID = 0UL; + gameObject.SetActive(false); + this.m_doc.IsShowTips = true; + } + } + } +} -- cgit v1.1-26-g67d0