From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/TooltipButtonOperateItemAny.cs | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/TooltipButtonOperateItemAny.cs (limited to 'Client/Assets/Scripts/XMainClient/TooltipButtonOperateItemAny.cs') diff --git a/Client/Assets/Scripts/XMainClient/TooltipButtonOperateItemAny.cs b/Client/Assets/Scripts/XMainClient/TooltipButtonOperateItemAny.cs new file mode 100644 index 00000000..855b6897 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/TooltipButtonOperateItemAny.cs @@ -0,0 +1,112 @@ +using System; +using UILib; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class TooltipButtonOperateItemAny : TooltipButtonOperateBase + { + private string m_Text; + + private ulong m_useCount; + + public override string GetButtonText() + { + return this.m_Text; + } + + public override bool HasRedPoint(XItem item) + { + return false; + } + + public override bool IsButtonVisible(XItem item) + { + ItemType type = item.Type; + if (type != ItemType.PECK) + { + if (type == ItemType.EMBLEM_MATERIAL) + { + this.m_Text = XStringDefineProxy.GetString("Make"); + return XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_Char_Emblem) && XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_EquipCreate_EmblemSet); + } + } + else + { + ChestList.RowData chestConf = XBagDocument.GetChestConf(item.itemID); + bool flag = chestConf != null && chestConf.MultiOpen; + if (flag) + { + this.m_useCount = (ulong)((long)XBagDocument.BagDoc.ItemBag.GetItemCountByUid(item.uid)); + bool flag2 = this.m_useCount > 1UL; + if (flag2) + { + this.m_Text = XStringDefineProxy.GetString("OpenAll"); + return true; + } + } + } + return false; + } + + public override void OnButtonClick(ulong mainUID, ulong compareUID) + { + base.OnButtonClick(mainUID, compareUID); + XItem itemByUID = XSingleton.singleton.Doc.XBagDoc.GetItemByUID(this.mainItemUID); + bool flag = itemByUID == null; + if (!flag) + { + ItemType type = itemByUID.Type; + if (type != ItemType.PECK) + { + if (type == ItemType.EMBLEM_MATERIAL) + { + XSingleton.singleton.OpenSystem(XSysDefine.XSys_EquipCreate_EmblemSet, 0UL); + } + } + else + { + ChestList.RowData chestConf = XBagDocument.GetChestConf(itemByUID.itemID); + bool flag2 = chestConf != null && chestConf.MultiOpen; + if (flag2) + { + this.OpenAnyTimesTip(itemByUID); + } + } + } + } + + private void OpenAnyTimesTip(XItem item) + { + ItemList.RowData itemConf = XBagDocument.GetItemConf(item.itemID); + bool flag = !item.bBinding && itemConf != null && itemConf.IsNeedShowTipsPanel == 1; + if (flag) + { + XSingleton.singleton.ShowModalDialog(XStringDefineProxy.GetString("CanNotSeal"), XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this.UseOnceItem)); + } + else + { + XSingleton.singleton.Doc.XBagDoc.UseItem(item, 0u, 0u); + } + } + + private bool UseOnceItem(IXUIButton btn) + { + XItem itemByUID = XSingleton.singleton.Doc.XBagDoc.GetItemByUID(this.mainItemUID); + bool flag = itemByUID == null; + bool result; + if (flag) + { + result = true; + } + else + { + XSingleton.singleton.Doc.XBagDoc.UseItem(itemByUID, 0u); + XSingleton.singleton.CloseModalDlg(); + result = true; + } + return result; + } + } +} -- cgit v1.1-26-g67d0