using System; using System.Collections.Generic; using KKSG; using UILib; using XMainClient.UI; using XMainClient.UI.UICommon; using XUtliPoolLib; namespace XMainClient { internal class TooltipButtonOperateItemUse : TooltipButtonOperateBase { private uint m_SystemID; private ItemUseButtonList.RowData m_RowData; private bool m_biShowPutInBtn; private List m_EndlessabyssShopItem; public TooltipButtonOperateItemUse() { this.m_EndlessabyssShopItem = XSingleton.singleton.GetIntList("EndlessabyssShopItem"); } public override string GetButtonText() { bool flag = this.m_RowData != null; string result; if (flag) { result = this.m_RowData.ButtonName; } else { result = string.Empty; } return result; } public override bool IsButtonVisible(XItem item) { this.m_biShowPutInBtn = XSingleton.singleton.bShowPutInBtn; XCharacterItemDocument specificDocument = XDocuments.GetSpecificDocument(XCharacterItemDocument.uuID); this.m_RowData = specificDocument.GetButtonData((uint)item.itemID, item.type); bool flag = this.m_RowData != null; bool result; if (flag) { this.m_SystemID = this.m_RowData.SystemID; for (int i = 0; i < this.m_EndlessabyssShopItem.Count; i++) { bool flag2 = item.itemID == this.m_EndlessabyssShopItem[i]; if (flag2) { this.m_SystemID = (uint)XFastEnumIntEqualityComparer.ToInt(ActivityHandler.GetShopSystem()); break; } } bool flag3 = item.Type == ItemType.EMBLEM_MATERIAL; if (flag3) { bool flag4 = this.m_SystemID != 0u && (!XSingleton.singleton.IsSystemOpened((XSysDefine)this.m_SystemID) || !XSingleton.singleton.IsSystemOpened(XSysDefine.XSys_Char_Emblem)); if (flag4) { return false; } } else { bool flag5 = this.m_SystemID != 0u && !XSingleton.singleton.IsSystemOpened((XSysDefine)this.m_SystemID); if (flag5) { return false; } } result = true; } else { result = false; } return result; } public override bool HasRedPoint(XItem item) { XCharacterItemDocument specificDocument = XDocuments.GetSpecificDocument(XCharacterItemDocument.uuID); return specificDocument.AvailableItems.IsNew(item.uid); } public override void OnButtonClick(ulong mainUID, ulong compareUID) { base.OnButtonClick(mainUID, compareUID); XItem itemByUID = XSingleton.singleton.Doc.XBagDoc.GetItemByUID(this.mainItemUID); bool flag = this.m_SystemID == 0u; if (flag) { bool flag2 = itemByUID != null; if (flag2) { ItemType type = itemByUID.Type; if (type != ItemType.LOTTERY_BOX) { switch (type) { case ItemType.FOOD_MENU: XHomeCookAndPartyDocument.Doc.SendActiveFoodMenu((uint)itemByUID.itemID); goto IL_136; case ItemType.Food_Eaten: { XSingleton.singleton.Doc.XBagDoc.UseItem(itemByUID, 7u); bool flag3 = DlgBase.singleton.IsVisible(); if (flag3) { DlgBase.singleton.PlayUseItemEffect(false); } goto IL_136; } case (ItemType)24: case (ItemType)25: break; case ItemType.PANDORA: { PandoraHeart.RowData pandoraHeartConf = XBagDocument.GetPandoraHeartConf(itemByUID.itemID, XSingleton.singleton.XPlayerData.BasicTypeID); PandoraDocument specificDocument = XDocuments.GetSpecificDocument(PandoraDocument.uuID); specificDocument.ShowPandoraLotteryView(pandoraHeartConf.PandoraID, pandoraHeartConf); goto IL_136; } default: if (type == ItemType.BagExpandTicket) { this.UseBagExpandTicket(itemByUID); goto IL_136; } break; } this.OpenOnceTip(itemByUID); } else { XCharacterItemDocument specificDocument2 = XDocuments.GetSpecificDocument(XCharacterItemDocument.uuID); specificDocument2.ShowWheelView(itemByUID); } IL_136:; } } else { bool flag4 = itemByUID != null; if (flag4) { ItemType type2 = itemByUID.Type; if (type2 != ItemType.Inscription) { XSingleton.singleton.OpenSystem((XSysDefine)this.m_SystemID, 0UL); } else { bool biShowPutInBtn = this.m_biShowPutInBtn; if (biShowPutInBtn) { ArtifactDeityStoveDocument.Doc.Additem(mainUID); } else { XSingleton.singleton.OpenSystem((XSysDefine)this.m_SystemID, 0UL); } } } else { XSingleton.singleton.OpenSystem((XSysDefine)this.m_SystemID, 0UL); } } } private void OpenOnceTip(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); } } private bool UseOnceItem(IXUIButton btn) { XItem itemByUID = XSingleton.singleton.Doc.XBagDoc.GetItemByUID(this.mainItemUID); bool flag = itemByUID != null; if (flag) { XSingleton.singleton.Doc.XBagDoc.UseItem(itemByUID, 0u); } XSingleton.singleton.CloseModalDlg(); return true; } private void UseBagExpandTicket(XItem item) { BagExpandItemListTable.RowData expandItemConf = XBagDocument.GetExpandItemConf((uint)item.itemID); bool flag = expandItemConf != null; if (flag) { ulong itemCount = XBagDocument.BagDoc.GetItemCount(item.itemID); BagExpandData bagExpandData = XBagDocument.BagDoc.GetBagExpandData((BagType)expandItemConf.Type); bool flag2 = bagExpandData != null; if (flag2) { bool flag3 = (uint)expandItemConf.NeedAndOpen.count > bagExpandData.ExpandTimes; if (flag3) { bool flag4 = itemCount >= (ulong)expandItemConf.NeedAndOpen[(int)bagExpandData.ExpandTimes, 0]; if (flag4) { XSingleton.singleton.Doc.XBagDoc.UseItem(item, 0u); } else { bool flag5 = item.itemConf != null; if (flag5) { XSingleton.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("BagExpandNeedNum"), expandItemConf.NeedAndOpen[(int)bagExpandData.ExpandTimes, 0], item.itemConf.ItemName[0], expandItemConf.NeedAndOpen[(int)bagExpandData.ExpandTimes, 1]), "fece00"); } } } else { XSingleton.singleton.ShowSystemTip(XSingleton.singleton.GetBagExpandFullTips((BagType)expandItemConf.Type), "fece00"); } } } } } }