From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/UI/EnchantAttrPreviewHandler.cs | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/EnchantAttrPreviewHandler.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/EnchantAttrPreviewHandler.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/EnchantAttrPreviewHandler.cs b/Client/Assets/Scripts/XMainClient/UI/EnchantAttrPreviewHandler.cs new file mode 100644 index 00000000..c664c6ff --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/EnchantAttrPreviewHandler.cs @@ -0,0 +1,89 @@ +using System; +using UILib; +using XUtliPoolLib; + +namespace XMainClient.UI +{ + internal class EnchantAttrPreviewHandler : DlgHandlerBase + { + private XEnchantDocument _doc = null; + + private IXUISprite m_Close; + + private IXUILabel m_AttrName; + + private IXUILabel m_AttrValue; + + private EnchantEquip.RowData m_Data; + + protected override void Init() + { + base.Init(); + this._doc = XDocuments.GetSpecificDocument(XEnchantDocument.uuID); + this.m_Close = (base.PanelObject.transform.Find("Close").GetComponent("XUISprite") as IXUISprite); + this.m_AttrName = (base.PanelObject.transform.Find("Detail/AttrName").GetComponent("XUILabel") as IXUILabel); + this.m_AttrValue = (base.PanelObject.transform.Find("Detail/AttrValue").GetComponent("XUILabel") as IXUILabel); + } + + public override void RegisterEvent() + { + base.RegisterEvent(); + this.m_Close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnCloseClicked)); + } + + protected override void OnShow() + { + base.OnShow(); + this.RefreshData(); + } + + public override void RefreshData() + { + base.RefreshData(); + bool flag = this.m_Data == null; + if (!flag) + { + XPrefixAttributes enchantAttrs = this._doc.GetEnchantAttrs(this.m_Data.EnchantID); + bool flag2 = enchantAttrs == null; + if (!flag2) + { + XSingleton.singleton.shareSB.Length = 0; + for (int i = 0; i < enchantAttrs.AttributeList.Count; i++) + { + XSingleton.singleton.shareSB.Append(XAttributeCommon.GetAttrStr((int)enchantAttrs.AttributeList[i].attrid)); + XSingleton.singleton.shareSB.Append('\n'); + } + this.m_AttrName.SetText(XSingleton.singleton.shareSB.ToString()); + XSingleton.singleton.shareSB.Length = 0; + for (int j = 0; j < enchantAttrs.AttributeList.Count; j++) + { + XSingleton.singleton.shareSB.Append(XAttributeCommon.GetAttrValueStr(enchantAttrs.AttributeList[j].attrid, (uint)enchantAttrs.AttributeList[j].minValue, true)); + XSingleton.singleton.shareSB.Append('~'); + XSingleton.singleton.shareSB.Append(XAttributeCommon.GetAttrValueStr(enchantAttrs.AttributeList[j].attrid, (uint)enchantAttrs.AttributeList[j].maxValue, false)); + XSingleton.singleton.shareSB.Append('\n'); + } + this.m_AttrValue.SetText(XSingleton.singleton.shareSB.ToString()); + } + } + } + + private void _OnCloseClicked(IXUISprite iSp) + { + base.SetVisible(false); + } + + public void Show(int itemid) + { + this.m_Data = this._doc.GetEnchantEquipData(itemid); + bool flag = this.m_Data == null; + if (flag) + { + XSingleton.singleton.AddErrorLog("Cant find enchant item config: " + itemid, null, null, null, null, null); + } + else + { + base.SetVisible(true); + } + } + } +} -- cgit v1.1-26-g67d0