LuckyBoxNewCardView.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. _cardId = (int)this.viewData;
  40. // _newCardList = new List<int>((this.viewData as object[])[0] as List<int>);
  41. updateView();
  42. }
  43. private void updateView()
  44. {
  45. ItemCfg cfg = ItemCfgArray.Instance.GetCfg(_cardId);
  46. _ui.m_loaBg.url = ResPathUtil.GetCardPath(cfg.res);
  47. }
  48. protected override void OnHide()
  49. {
  50. base.OnHide();
  51. }
  52. protected override void RemoveEventListener()
  53. {
  54. base.RemoveEventListener();
  55. }
  56. private void OnClickBg()
  57. {
  58. if (!GetSuitItemController.isAuto)
  59. {
  60. this.Hide();
  61. }
  62. }
  63. }
  64. }