ZCJBBuyTipsView.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Collections.Generic;
  3. using UI.ActivityMain;
  4. using FairyGUI;
  5. using UI.CommonGame;
  6. namespace GFGGame
  7. {
  8. public class ZCJBBuyTipsView : BaseWindow
  9. {
  10. private UI_ZCJBBuyTips _ui;
  11. private string Desc;
  12. public override void Dispose()
  13. {
  14. if (_ui != null)
  15. {
  16. _ui.Dispose();
  17. _ui = null;
  18. }
  19. BuyTipsController.Dispose();
  20. base.Dispose();
  21. }
  22. protected override void OnInit()
  23. {
  24. base.OnInit();
  25. _ui = UI_ZCJBBuyTips.Create();
  26. this.viewCom = _ui.target;
  27. this.viewCom.Center();
  28. this.modal = true;
  29. _ui.m_btnRight.onClick.Add(OnClickBtnSure);
  30. _ui.m_btnLeft.onClick.Add(OnClickBtnCancel);
  31. }
  32. protected override void OnShown()
  33. {
  34. base.OnShown();
  35. Desc = (string)(this.viewData as object[])[0];
  36. UpdateView();
  37. }
  38. protected override void AddEventListener()
  39. {
  40. base.AddEventListener();
  41. EventAgent.AddEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, LimitChanged);
  42. }
  43. protected override void RemoveEventListener()
  44. {
  45. base.RemoveEventListener();
  46. EventAgent.RemoveEventListener(ConstMessage.NOTICE_LIMIT_CHANGED, LimitChanged);
  47. }
  48. private void UpdateView()
  49. {
  50. _ui.m_txtContent.text = Desc;
  51. _ui.m_txtTips.text = "(购买的次数请及时使用,次日5:00重置)";
  52. }
  53. private void OnClickBtnSure()
  54. {
  55. RoleLimitSProxy.ReqBuyLimitPlayTimes(500, 1, 1).Coroutine();
  56. }
  57. private void LimitChanged(EventContext context = null)
  58. {
  59. if ((int)context.data != 500)
  60. {
  61. return;
  62. }
  63. PromptController.Instance.ShowFloatTextPrompt("次数+1");
  64. }
  65. private void OnClickBtnCancel()
  66. {
  67. this.Hide();
  68. }
  69. }
  70. }