StoreArenaView.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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 StoreArenaView : BaseWindow
  9. {
  10. private UI_StoreExchangeUI _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_StoreExchangeUI.PACKAGE_NAME;
  25. _ui = UI_StoreExchangeUI.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_ARENA, menu2);
  40. _shopCfgs = ShopDataManager.Instance.SortGiftBagCfgs(_shopCfgs);
  41. _ui.m_list.numItems = _shopCfgs.Count;
  42. }
  43. protected override void OnHide()
  44. {
  45. base.OnHide();
  46. }
  47. protected override void RemoveEventListener()
  48. {
  49. base.RemoveEventListener();
  50. }
  51. private void ListItemRenderer(int index, GObject obj)
  52. {
  53. ShopCfg shopCfg = _shopCfgs[index];
  54. ShopViewManager.Instance.UptadeItem(obj, shopCfg);
  55. UI_ListShopItem item = UI_ListShopItem.Proxy(obj);
  56. ItemCfg costItemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.menu2 == 0 || shopCfg.menu2 == ArenaDataManager.Instance.SeasonId ? shopCfg.costId : shopCfg.oldSeasonCostId);
  57. item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(costItemCfg.res);
  58. UI_ListShopItem.ProxyEnd();
  59. }
  60. }
  61. }