LuckyBoxNewCardView.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 LuckyBoxNewCardView : BaseWindow
  9. {
  10. private UI_LuckyBoxNewCardUI _ui;
  11. // private List<int> _newCardList = new List<int>();
  12. // private List<ItemData> _newDressList = new List<ItemData>();
  13. private int _cardId;
  14. public override void Dispose()
  15. {
  16. if (_ui != null)
  17. {
  18. _ui.Dispose();
  19. _ui = null;
  20. }
  21. base.Dispose();
  22. }
  23. protected override void OnInit()
  24. {
  25. base.OnInit();
  26. packageName = UI_LuckyBoxNewCardUI.PACKAGE_NAME;
  27. _ui = UI_LuckyBoxNewCardUI.Create();
  28. this.viewCom = _ui.target;
  29. isfullScreen = true;
  30. _ui.m_loaBg.onClick.Add(OnClickBg);
  31. }
  32. protected override void AddEventListener()
  33. {
  34. base.AddEventListener();
  35. }
  36. protected override void OnShown()
  37. {
  38. base.OnShown();
  39. _ui.m_loaBg.touchable = false;
  40. _cardId = (int)this.viewData;
  41. // _newCardList = new List<int>((this.viewData as object[])[0] as List<int>);
  42. updateView();
  43. Timers.inst.Add(0.5f, 1, OnTimerClick);
  44. }
  45. private void updateView()
  46. {
  47. ItemCfg cfg = ItemCfgArray.Instance.GetCfg(_cardId);
  48. _ui.m_loaBg.url = ResPathUtil.GetCardPath(cfg.res);
  49. }
  50. protected override void OnHide()
  51. {
  52. base.OnHide();
  53. Timers.inst.Remove(OnTimerClick);
  54. _ui.m_loaBg.touchable = true;
  55. }
  56. protected override void RemoveEventListener()
  57. {
  58. base.RemoveEventListener();
  59. }
  60. private void OnTimerClick(object param)
  61. {
  62. _ui.m_loaBg.touchable = true;
  63. }
  64. private void OnClickBg()
  65. {
  66. if (!GetSuitItemController.isAuto)
  67. {
  68. this.Hide();
  69. }
  70. }
  71. }
  72. }