From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/TooltipButtonOperateSell.cs | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/TooltipButtonOperateSell.cs (limited to 'Client/Assets/Scripts/XMainClient/TooltipButtonOperateSell.cs') diff --git a/Client/Assets/Scripts/XMainClient/TooltipButtonOperateSell.cs b/Client/Assets/Scripts/XMainClient/TooltipButtonOperateSell.cs new file mode 100644 index 00000000..b972c74d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/TooltipButtonOperateSell.cs @@ -0,0 +1,85 @@ +using System; +using UILib; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class TooltipButtonOperateSell : TooltipButtonOperateBase + { + private int itemCount = 0; + + private ItemList.RowData itemRowData = null; + + private uint moneyID = 0u; + + private uint moneyCount = 0u; + + public override string GetButtonText() + { + return XStringDefineProxy.GetString("SELL"); + } + + public override bool HasRedPoint(XItem item) + { + return false; + } + + public override bool IsButtonVisible(XItem item) + { + return this._CanItemBeSold(item); + } + + public override void OnButtonClick(ulong mainUID, ulong compareUID) + { + base.OnButtonClick(mainUID, compareUID); + ItemList.RowData itemConf = XBagDocument.GetItemConf((int)this.moneyID); + bool flag = itemConf == null || this.itemRowData == null; + if (!flag) + { + string @string = XStringDefineProxy.GetString("ItemSellConfirm", new object[] + { + this.itemCount.ToString(), + XSingleton.singleton.ChooseProfString(this.itemRowData.ItemName, 0u), + ((long)((ulong)this.moneyCount * (ulong)((long)this.itemCount))).ToString(), + XSingleton.singleton.ChooseProfString(itemConf.ItemName, 0u) + }); + XSingleton.singleton.ShowModalDialog(@string, XStringDefineProxy.GetString(XStringDefine.COMMON_OK), XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL), new ButtonClickEventHandler(this._OnSellClicked)); + } + } + + protected bool _CanItemBeSold(XItem item) + { + bool flag = item == null || item.itemConf == null; + bool result; + if (flag) + { + result = false; + } + else + { + bool flag2 = item.itemConf.Sell[0] > 0u; + if (flag2) + { + this.itemCount = item.itemCount; + this.itemRowData = item.itemConf; + this.moneyID = item.itemConf.Sell[0]; + this.moneyCount = item.itemConf.Sell[1]; + result = true; + } + else + { + result = false; + } + } + return result; + } + + private bool _OnSellClicked(IXUIButton btn) + { + XSingleton.singleton.CloseModalDlg(); + XSingleton.singleton.Doc.XBagDoc.ReqItemSell(this.mainItemUID); + return true; + } + } +} -- cgit v1.1-26-g67d0