| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 | using System;using UI.CommonGame;using UnityEngine;namespace GFGGame{    public class BuyConfirmView : BaseWindow    {        private UI_BuyConfirmUI _ui;        public override void Dispose()        {            if (_ui != null)            {                _ui.Dispose();                _ui = null;            }            base.Dispose();        }        protected override void OnInit()        {            base.OnInit();            _ui = UI_BuyConfirmUI.Create();            this.viewCom = _ui.target;            this.viewCom.Center();            this.modal = true;            viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;            _ui.m_btnSure.onClick.Add(OnClickBtnSure);            _ui.m_btnCancel.onClick.Add(OnClickBtnCancel);        }        protected override void AddEventListener()        {            base.AddEventListener();            EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateView);        }        protected override void OnShown()        {            base.OnShown();            UpdateView();        }        protected override void RemoveEventListener()        {            base.RemoveEventListener();            EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateView);        }        private void UpdateView()        {            ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(GlobalCfgArray.globalCfg.costIdBuyFightTimes);            _ui.m_txtMessage.text = string.Format("是否使用{0}{1}增加1次飞花令挑战次数? \n\u3000\u3000\u3000\u3000(开通阿福卡可储存次数)", GlobalCfgArray.globalCfg.costNumBuyFightTimes, itemCfg.name);            _ui.m_txtTips.text = string.Format("(今天已购买{0}/{1}次)", GlobalCfgArray.globalCfg.limitDailyBuyFightTimes - RoleDataManager.ArenaBuyFightTimes, GlobalCfgArray.globalCfg.limitDailyBuyFightTimes);        }        private void OnClickBtnSure()        {            int costId = GlobalCfgArray.globalCfg.costIdBuyFightTimes;            long needNum = GlobalCfgArray.globalCfg.costNumBuyFightTimes;            if (!ItemUtil.CheckItemEnough(costId, needNum))            {                long has = ItemDataManager.GetItemNum(costId);                ItemUtil.BuyCurrency(costId, needNum - has);                return;            }            // if (RoleDataManager.ArenaFightTimes >=RoleDataManager.ArenaMaxStorageNum)            // {            //     PromptController.Instance.ShowFloatTextPrompt("已达到最大存储次数");            //     return;            // }            ArenaSproxy.ReqBuyArenaFightTimes().Coroutine();        }        private void OnClickBtnCancel()        {            this.Hide();        }    }}
 |