LuckyBoxNewCardView.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. public override void Dispose()
  14. {
  15. if (_ui != null)
  16. {
  17. _ui.Dispose();
  18. _ui = null;
  19. }
  20. base.Dispose();
  21. }
  22. protected override void OnInit()
  23. {
  24. base.OnInit();
  25. packageName = UI_LuckyBoxNewCardUI.PACKAGE_NAME;
  26. _ui = UI_LuckyBoxNewCardUI.Create();
  27. this.viewCom = _ui.target;
  28. isfullScreen = true;
  29. _ui.m_loaBg.onClick.Add(OnClickBtnBg);
  30. }
  31. protected override void AddEventListener()
  32. {
  33. base.AddEventListener();
  34. }
  35. protected override void OnShown()
  36. {
  37. base.OnShown();
  38. _newCardList = new List<int>((this.viewData as object[])[0] as List<int>);
  39. _newDressList = new List<ItemData>((this.viewData as object[])[1] as List<ItemData>);
  40. updateView();
  41. }
  42. private void updateView()
  43. {
  44. ItemCfg cfg = ItemCfgArray.Instance.GetCfg(_newCardList[0]);
  45. _ui.m_loaBg.url = ResPathUtil.GetCardPath(cfg.res);
  46. _newCardList.RemoveAt(0);
  47. }
  48. protected override void OnHide()
  49. {
  50. base.OnHide();
  51. }
  52. protected override void RemoveEventListener()
  53. {
  54. base.RemoveEventListener();
  55. }
  56. private void OnClickBtnBg()
  57. {
  58. if (_newCardList.Count == 0)
  59. {
  60. this.Hide();
  61. if (_newDressList.Count > 0)
  62. {
  63. ViewManager.Show<LuckyBoxNewDressView>(_newDressList);
  64. }
  65. return;
  66. }
  67. updateView();
  68. }
  69. }
  70. }