summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/EnchantAttrPreviewHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/UI/EnchantAttrPreviewHandler.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/UI/EnchantAttrPreviewHandler.cs89
1 files changed, 89 insertions, 0 deletions
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>(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<XCommon>.singleton.shareSB.Length = 0;
+ for (int i = 0; i < enchantAttrs.AttributeList.Count; i++)
+ {
+ XSingleton<XCommon>.singleton.shareSB.Append(XAttributeCommon.GetAttrStr((int)enchantAttrs.AttributeList[i].attrid));
+ XSingleton<XCommon>.singleton.shareSB.Append('\n');
+ }
+ this.m_AttrName.SetText(XSingleton<XCommon>.singleton.shareSB.ToString());
+ XSingleton<XCommon>.singleton.shareSB.Length = 0;
+ for (int j = 0; j < enchantAttrs.AttributeList.Count; j++)
+ {
+ XSingleton<XCommon>.singleton.shareSB.Append(XAttributeCommon.GetAttrValueStr(enchantAttrs.AttributeList[j].attrid, (uint)enchantAttrs.AttributeList[j].minValue, true));
+ XSingleton<XCommon>.singleton.shareSB.Append('~');
+ XSingleton<XCommon>.singleton.shareSB.Append(XAttributeCommon.GetAttrValueStr(enchantAttrs.AttributeList[j].attrid, (uint)enchantAttrs.AttributeList[j].maxValue, false));
+ XSingleton<XCommon>.singleton.shareSB.Append('\n');
+ }
+ this.m_AttrValue.SetText(XSingleton<XCommon>.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<XDebug>.singleton.AddErrorLog("Cant find enchant item config: " + itemid, null, null, null, null, null);
+ }
+ else
+ {
+ base.SetVisible(true);
+ }
+ }
+ }
+}