LuckyBoxWishView.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System.Collections.Generic;
  2. using ET;
  3. using FairyGUI;
  4. using UI.LuckyBox;
  5. using UnityEngine;
  6. namespace GFGGame
  7. {
  8. public class LuckyBoxWishView : BaseWindow
  9. {
  10. private UI_LuckyBoxWishUI _ui;
  11. private int _actLimitTsy = 0;
  12. public override void Dispose()
  13. {
  14. if (_ui != null)
  15. {
  16. _ui.Dispose();
  17. _ui = null;
  18. }
  19. base.Dispose();
  20. }
  21. protected override void OnInit()
  22. {
  23. base.OnInit();
  24. packageName = UI_LuckyBoxWishUI.PACKAGE_NAME;
  25. _ui = UI_LuckyBoxWishUI.Create();
  26. this.viewCom = _ui.target;
  27. this.viewCom.Center();
  28. this.modal = true;
  29. _ui.m_btnWish1.data = 0;
  30. _ui.m_btnWish1.onClick.Add(OnClickBtnWish);
  31. _ui.m_btnWish1.data = 1;
  32. _ui.m_btnWish2.onClick.Add(OnClickBtnWish);
  33. }
  34. protected override void AddEventListener()
  35. {
  36. base.AddEventListener();
  37. }
  38. protected override void OnShown()
  39. {
  40. base.OnShown();
  41. _actLimitTsy = (int)this.viewData;
  42. }
  43. protected override void OnHide()
  44. {
  45. base.OnHide();
  46. }
  47. protected override void RemoveEventListener()
  48. {
  49. base.RemoveEventListener();
  50. }
  51. private void OnClickBtnWish(EventContext context)
  52. {
  53. int index = (int)(context.sender as GObject).data;
  54. ReqAddWishingPoolInfo(index);
  55. this.Hide();
  56. }
  57. private async void ReqAddWishingPoolInfo(int index)
  58. {
  59. int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(_actLimitTsy);
  60. ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(activityId);
  61. bool result = await LuckyBoxSProxy.ReqAddWishingPoolInfo(activityOpenCfg.params2Arr[index], activityId);
  62. if (result)
  63. {
  64. }
  65. }
  66. }
  67. }