StoreChargeAddUpView.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 StoreChargeAddUpView : BaseWindow
  9. {
  10. private UI_StoreGiftBagUI _ui;
  11. private ValueBarController _valueBarController;
  12. private List<ShopCfg> _shopCfgs;
  13. public override void Dispose()
  14. {
  15. if (_valueBarController != null)
  16. {
  17. _valueBarController.Dispose();
  18. _valueBarController = null;
  19. }
  20. if (_ui != null)
  21. {
  22. _ui.Dispose();
  23. }
  24. _ui = null;
  25. base.Dispose();
  26. }
  27. protected override void OnInit()
  28. {
  29. base.OnInit();
  30. packageName = UI_StoreGiftBagUI.PACKAGE_NAME;
  31. _ui = UI_StoreGiftBagUI.Create();
  32. this.viewCom = _ui.target;
  33. isfullScreen = true;
  34. this.clickBlankToClose = false;
  35. _ui.m_list.itemRenderer = ListItemRenderer;
  36. _valueBarController = new ValueBarController(_ui.m_valueBar);
  37. }
  38. protected override void AddEventListener()
  39. {
  40. base.AddEventListener();
  41. }
  42. protected override void OnShown()
  43. {
  44. base.OnShown();
  45. int menu2 = (int)this.viewData;
  46. _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_GIFT_BAG, menu2);
  47. _shopCfgs = ShopDataManager.Instance.SortShopGoodsCfgs(_shopCfgs);
  48. _ui.m_list.numItems = _shopCfgs.Count;
  49. _valueBarController.OnShown();
  50. }
  51. protected override void OnHide()
  52. {
  53. base.OnHide();
  54. _valueBarController.OnHide();
  55. }
  56. protected override void RemoveEventListener()
  57. {
  58. base.RemoveEventListener();
  59. }
  60. private void ListItemRenderer(int index, GObject obj)
  61. {
  62. ShopCfg shopCfg = _shopCfgs[index];
  63. ShopViewManager.Instance.UptadeItem(obj, shopCfg);
  64. }
  65. }
  66. }