using System; using System.Collections.Generic; using UI.ActivityMain; using FairyGUI; using UI.CommonGame; namespace GFGGame { public class ZCJBBuyTipsView : BaseWindow { private UI_ZCJBBuyTips _ui; private string Desc; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } BuyTipsController.Dispose(); base.Dispose(); } protected override void OnInit() { base.OnInit(); _ui = UI_ZCJBBuyTips.Create(); this.viewCom = _ui.target; this.viewCom.Center(); this.modal = true; _ui.m_btnRight.onClick.Add(OnClickBtnSure); _ui.m_btnLeft.onClick.Add(OnClickBtnCancel); } protected override void OnShown() { base.OnShown(); Desc = (string)(this.viewData as object[])[0]; UpdateView(); } protected override void AddEventListener() { base.AddEventListener(); EventAgent.AddEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, LimitChanged); } protected override void RemoveEventListener() { base.RemoveEventListener(); EventAgent.RemoveEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, LimitChanged); } private void UpdateView() { _ui.m_txtContent.text = Desc; _ui.m_txtTips.text = "(购买的次数请及时使用,次日5:00重置)"; } private void OnClickBtnSure() { RoleLimitSProxy.ReqBuyLimitPlayTimes(500, 1, 1).Coroutine(); EventAgent.DispatchEvent(ConstMessage.NUMERIC_CHANGE); } private void LimitChanged(EventContext context = null) { if ((int)context.data != 500) { return; } PromptController.Instance.ShowFloatTextPrompt("次数+1"); } private void OnClickBtnCancel() { this.Hide(); } } }