diff options
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/ForgeReplaceHandler.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/ForgeReplaceHandler.cs | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/ForgeReplaceHandler.cs b/Client/Assets/Scripts/XMainClient/ForgeReplaceHandler.cs new file mode 100644 index 00000000..1a423ca6 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/ForgeReplaceHandler.cs @@ -0,0 +1,102 @@ +using System;
+using KKSG;
+using UILib;
+using UnityEngine;
+
+namespace XMainClient
+{
+ internal class ForgeReplaceHandler : DlgHandlerBase
+ {
+ private XForgeDocument m_doc;
+
+ private IXUIButton m_cancleBtn;
+
+ private IXUIButton m_sureBtn;
+
+ private IXUILabel m_beforeName;
+
+ private IXUILabel m_beforeAttr;
+
+ private IXUILabel m_afterName;
+
+ private IXUILabel m_afterAttr;
+
+ protected override void Init()
+ {
+ base.Init();
+ this.m_doc = XForgeDocument.Doc;
+ this.m_cancleBtn = (base.PanelObject.transform.Find("Bg/Cancel").GetComponent("XUIButton") as IXUIButton);
+ this.m_sureBtn = (base.PanelObject.transform.Find("Bg/OK").GetComponent("XUIButton") as IXUIButton);
+ Transform transform = base.PanelObject.transform.Find("Bg/AttrItem");
+ this.m_beforeName = (transform.Find("BeforeName").GetComponent("XUILabel") as IXUILabel);
+ this.m_beforeAttr = (transform.Find("BeforeValue").GetComponent("XUILabel") as IXUILabel);
+ this.m_afterName = (transform.Find("Name").GetComponent("XUILabel") as IXUILabel);
+ this.m_afterAttr = (transform.Find("NowValue").GetComponent("XUILabel") as IXUILabel);
+ }
+
+ public override void RegisterEvent()
+ {
+ base.RegisterEvent();
+ this.m_cancleBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCancleClicked));
+ this.m_sureBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnSureClicked));
+ }
+
+ protected override void OnShow()
+ {
+ base.OnShow();
+ this.FillContent();
+ }
+
+ protected override void OnHide()
+ {
+ base.OnHide();
+ }
+
+ public override void OnUnload()
+ {
+ base.OnUnload();
+ }
+
+ private void FillContent()
+ {
+ 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_beforeName.SetText(text);
+ text = string.Format("[{0}]{1}[-]", color, xequipItem.forgeAttrInfo.ForgeAttr[0].AttrValue);
+ this.m_beforeAttr.SetText(text);
+ text = string.Format("[{0}]{1}[-]", color, XAttributeCommon.GetAttrStr((int)xequipItem.forgeAttrInfo.UnSavedAttrid));
+ this.m_afterName.SetText(text);
+ text = string.Format("[{0}]{1}[-]", color, xequipItem.forgeAttrInfo.UnSavedAttrValue);
+ this.m_afterAttr.SetText(text);
+ }
+ }
+ }
+ }
+
+ private bool OnCancleClicked(IXUIButton btn)
+ {
+ base.SetVisible(false);
+ this.m_doc.ReqForgeEquip(ForgeOpType.Forge_Retain);
+ return true;
+ }
+
+ private bool OnSureClicked(IXUIButton btn)
+ {
+ base.SetVisible(false);
+ this.m_doc.ReqForgeEquip(ForgeOpType.Forge_Replace);
+ return true;
+ }
+ }
+}
|