diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/TooltipButtonOperateSell.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/TooltipButtonOperateSell.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/TooltipButtonOperateSell.cs | 85 |
1 files changed, 85 insertions, 0 deletions
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<UiUtility>.singleton.ChooseProfString(this.itemRowData.ItemName, 0u),
+ ((long)((ulong)this.moneyCount * (ulong)((long)this.itemCount))).ToString(),
+ XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemName, 0u)
+ });
+ XSingleton<UiUtility>.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<UiUtility>.singleton.CloseModalDlg();
+ XSingleton<XGame>.singleton.Doc.XBagDoc.ReqItemSell(this.mainItemUID);
+ return true;
+ }
+ }
+}
|