1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- using UI.Store;
- using UI.CommonGame;
- using FairyGUI;
- using System.Collections.Generic;
- using ET;
- namespace GFGGame
- {
- public class StoreGiftBagView : BaseWindow
- {
- private UI_StoreGiftBagUI _ui;
- private ValueBarController _valueBarController;
- private List<ShopCfg> _shopCfgs;
- private int menu2;
- public override void Dispose()
- {
- if (_valueBarController != null)
- {
- _valueBarController.Dispose();
- _valueBarController = null;
- }
- if (_ui != null)
- {
- _ui.Dispose();
- }
- _ui = null;
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_StoreGiftBagUI.PACKAGE_NAME;
- _ui = UI_StoreGiftBagUI.Create();
- this.viewCom = _ui.target;
- isfullScreen = true;
- this.clickBlankToClose = false;
- this.bringToFontOnClick = false;
- _ui.m_storeGiftBagList.m_list.itemRenderer = ListItemRenderer;
- _valueBarController = new ValueBarController(_ui.m_valueBar);
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);
- }
- protected override void OnShown()
- {
- base.OnShown();
- menu2 = (int)this.viewData;
- _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_GIFT_BAG, menu2);
- _shopCfgs = ShopDataManager.Instance.RemoveNotOpenCfg(_shopCfgs);
- _valueBarController.OnShown();
- _valueBarController.UpdateList(ShopDataManager.Instance.GetShopCostIds(_shopCfgs));
- _ui.m_storeGiftBagList.m_list.scrollPane.ScrollTop();
- UpdateView();
- }
- protected override void OnHide()
- {
- base.OnHide();
- ShopViewManager.Instance.ClearItemEff();
- _valueBarController.OnHide();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateView);
- }
- private void UpdateView()
- {
- _shopCfgs = ShopDataManager.Instance.SortShopGoodsCfgs(_shopCfgs);
- ShopViewManager.Instance.ClearItemEff();
- _ui.m_storeGiftBagList.m_list.numItems = _shopCfgs.Count;
- }
- private void ListItemRenderer(int index, GObject obj)
- {
- ShopCfg shopCfg = _shopCfgs[index];
- ShopViewManager.Instance.UptadeItem(obj, shopCfg);
- RedDotController.Instance.SetComRedDot(obj.asCom, menu2 == ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY && shopCfg.Price == 0 && ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id) < shopCfg.maxBuyNum, "", 5, 76);
- }
- }
- }
|