GiftBagStoreView.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. using UI.Store;
  2. using UI.CommonGame;
  3. using FairyGUI;
  4. using System.Collections.Generic;
  5. using ET;
  6. namespace GFGGame
  7. {
  8. public class GiftBagStoreView : BaseWindow
  9. {
  10. private UI_GiftBagStoreUI _ui;
  11. private List<ShopCfg> _shopCfgs;
  12. public override void Dispose()
  13. {
  14. if (_ui != null)
  15. {
  16. _ui.Dispose();
  17. }
  18. _ui = null;
  19. base.Dispose();
  20. }
  21. protected override void OnInit()
  22. {
  23. base.OnInit();
  24. packageName = UI_GiftBagStoreUI.PACKAGE_NAME;
  25. _ui = UI_GiftBagStoreUI.Create();
  26. this.viewCom = _ui.target;
  27. isfullScreen = true;
  28. this.clickBlankToClose = false;
  29. _ui.m_list.itemRenderer = ListItemRenderer;
  30. }
  31. protected override void AddEventListener()
  32. {
  33. base.AddEventListener();
  34. }
  35. protected override void OnShown()
  36. {
  37. base.OnShown();
  38. int menu2 = (int)this.viewData;
  39. _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_GIFT_BAG, menu2);
  40. _ui.m_list.numItems = _shopCfgs.Count;
  41. }
  42. protected override void OnHide()
  43. {
  44. base.OnHide();
  45. }
  46. protected override void RemoveEventListener()
  47. {
  48. base.RemoveEventListener();
  49. }
  50. private void ListItemRenderer(int index, GObject obj)
  51. {
  52. ShopCfg shopCfg = _shopCfgs[index];
  53. ShopViewManager.Instance.UptadeItem(obj, shopCfg);
  54. }
  55. }
  56. }