From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Assets/Scripts/XMainClient/UI/XBuyCountView.cs | 106 +++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/XBuyCountView.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/XBuyCountView.cs') 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 + { + 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.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.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; + } + } +} -- cgit v1.1-26-g67d0