summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/UI/XBuyCountView.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/UI/XBuyCountView.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/UI/XBuyCountView.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/UI/XBuyCountView.cs106
1 files changed, 106 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/UI/XBuyCountView.cs b/Client/Assets/Scripts/XMainClient/UI/XBuyCountView.cs
new file mode 100644
index 00000000..6bbac211
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/UI/XBuyCountView.cs
@@ -0,0 +1,106 @@
+using System;
+using KKSG;
+using UILib;
+using XMainClient.UI.UICommon;
+using XUtliPoolLib;
+
+namespace XMainClient.UI
+{
+ internal class XBuyCountView : DlgBase<XBuyCountView, XBuyCountBehaviour>
+ {
+ public override string fileName
+ {
+ get
+ {
+ return "Common/BuyCountDlg";
+ }
+ }
+
+ public override int layer
+ {
+ get
+ {
+ return 100;
+ }
+ }
+
+ public override bool autoload
+ {
+ get
+ {
+ return true;
+ }
+ }
+
+ private TeamLevelType m_Type;
+
+ private XExpeditionDocument m_ExpDoc;
+
+ protected override void Init()
+ {
+ this.m_ExpDoc = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
+ }
+
+ public override void RegisterEvent()
+ {
+ base.uiBehaviour.m_CancelButton.RegisterClickEventHandler(new ButtonClickEventHandler(this._DoCancel));
+ base.uiBehaviour.m_OKButton.RegisterClickEventHandler(new ButtonClickEventHandler(this._DoOK));
+ }
+
+ protected override void OnShow()
+ {
+ base.OnShow();
+ }
+
+ public void ActiveShow(TeamLevelType dungeonType)
+ {
+ this._ShowBuyCountAndBuyConfirm("ACTIVE_BUYCOUNT_CONFIRM", dungeonType);
+ }
+
+ public void PassiveShow(TeamLevelType dungeonType)
+ {
+ this._ShowBuyCountAndBuyConfirm("PASSIVE_BUYCOUNT_CONFIRM", dungeonType);
+ }
+
+ private void _ShowBuyCountAndBuyConfirm(string reason, TeamLevelType dungeonType)
+ {
+ base.Load();
+ int num;
+ int num2;
+ bool flag = this.m_ExpDoc.CanBuy(dungeonType, out num, out num2);
+ if (flag)
+ {
+ CostInfo buyCost = this.m_ExpDoc.GetBuyCost(dungeonType);
+ base.uiBehaviour.m_ContentLabelSymbol.InputText = XStringDefineProxy.GetString(reason, new object[]
+ {
+ XLabelSymbolHelper.FormatCostWithIcon((int)buyCost.count, buyCost.type),
+ XStringDefineProxy.GetString(dungeonType.ToString())
+ });
+ base.uiBehaviour.m_LeftBuyCount.SetText((num2 - num).ToString());
+ this.m_Type = dungeonType;
+ this.SetVisibleWithAnimation(true, null);
+ }
+ else
+ {
+ bool flag2 = this.m_ExpDoc.GetBuyLimit(dungeonType) > 0;
+ if (flag2)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(ErrorCode.ERR_TEAMBUY_COUNT_MAX, "fece00");
+ }
+ }
+ }
+
+ private bool _DoOK(IXUIButton go)
+ {
+ this.SetVisibleWithAnimation(false, null);
+ this.m_ExpDoc.ReqBuyCount(this.m_Type);
+ return true;
+ }
+
+ private bool _DoCancel(IXUIButton go)
+ {
+ this.SetVisibleWithAnimation(false, null);
+ return true;
+ }
+ }
+}