12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- 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;
- private int limitID;
- 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);
- _ui.m_graphBg.onClick.Add(OnClickBtnCancel);
- }
- protected override void OnShown()
- {
- base.OnShown();
- Desc = (string)(this.viewData as object[])[0];
- limitID = (int)(this.viewData as object[])[1];
- 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(limitID, 1, 1).Coroutine();
- }
- private void LimitChanged(EventContext context = null)
- {
- if ((int)context.data != limitID)
- {
- return;
- }
- PromptController.Instance.ShowFloatTextPrompt("次数+1");
- }
- private void OnClickBtnCancel()
- {
- this.Hide();
- }
- }
- }
|