| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 | 
							- using UI.Store;
 
- using UI.CommonGame;
 
- using FairyGUI;
 
- using System.Collections.Generic;
 
- using ET;
 
- using UnityEngine;
 
- // using System.Diagnostics;
 
- namespace GFGGame
 
- {
 
-     public class StoreView : BaseWindow
 
-     {
 
-         private UI_StoreUI _ui;
 
-         // private ValueBarController _valueBarController;
 
-         private List<List<string>> _arenaSubTab = new List<List<string>>();
 
-         private List<string[]> _storeTabCfgs = new List<string[]>();
 
-         private int _curTabIndex = 0;
 
-         private int _curSubTabIndex = 0;
 
-         private string _curViewName = "";
 
-         public override void Dispose()
 
-         {
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-             }
 
-             _arenaSubTab.Clear();
 
-             _ui = null;
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             packageName = UI_StoreUI.PACKAGE_NAME;
 
-             _ui = UI_StoreUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             isReturnView = true;
 
-             this.bringToFontOnClick = false;
 
-             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("bg_fhl");
 
-             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
 
-             _ui.m_comTab.m_c1.onChanged.Add(OnTabChange);
 
-             _ui.m_listSubTab.itemRenderer = RenderListSubTabItem;
 
-             _ui.m_listSubTab.onClickItem.Add(OnListSubTabClick);
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
 
-             EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateRedDot);
 
-             EventAgent.AddEventListener(ConstMessage.NOTICE_BATCH_TASK_STATE_CHANGE, UpdateStoreMonthRedDot);
 
-             EventAgent.AddEventListener(ConstMessage.STORE_BROCADE_WEAV_RECEIVE, UpdateStoreMonthRedDot);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             StoreTabCfg arenaTab = StoreTabCfgArray.Instance.GetCfgByfunctionId(ConstFunctionId.STORE_ARENA);
 
-             _arenaSubTab.Clear();
 
-             _arenaSubTab.Add(new List<string>() { arenaTab.subTabArr[0][0], arenaTab.subTabArr[0][1], arenaTab.subTabArr[0][2] });
 
-             for (int i = ArenaDataManager.Instance.SeasonId; i > 0; i--)
 
-             {
 
-                 _arenaSubTab.Add(new List<string>() { string.Format("第{0}赛季", i), i.ToString(), "StoreArenaView" });
 
-             }
 
-             _curTabIndex = this.viewData == null ? ConstStoreTabId.STORE_CHARGE : (int)(this.viewData as object[])[0];
 
-             _ui.m_comTab.m_c1.selectedIndex = _curTabIndex;
 
-             _ui.m_comTab.target.scrollPane.SetPercX((float)(_curTabIndex - 1) / (float)StoreTabCfgArray.Instance.dataArray.Length, false);
 
-             _curSubTabIndex = this.viewData == null ? 0 : (int)(this.viewData as object[])[1];
 
-             if (_curTabIndex == ConstStoreTabId.STORE_GIFT_BAG && _curSubTabIndex > 0 && !ShopDataManager.Instance.GetShopActivityIsShow()) {
 
-                 _curSubTabIndex -= 1;
 
-             }
 
-             if (_ui.m_listSubTab.numItems > _curSubTabIndex)
 
-             {
 
-                 _ui.m_listSubTab.selectedIndex = _curSubTabIndex;
 
-                 _ui.m_listSubTab.ScrollToView(_curSubTabIndex);
 
-                 OnListSubTabChange(_curSubTabIndex);
 
-             }
 
-             UpdateRedDot();
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-             _ui.m_comTab.m_c1.selectedIndex = 0;
 
-             _ui.m_listSubTab.selectedIndex = 0;
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateRedDot);
 
-             EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateRedDot);
 
-             EventAgent.RemoveEventListener(ConstMessage.NOTICE_BATCH_TASK_STATE_CHANGE, UpdateStoreMonthRedDot);
 
-             EventAgent.RemoveEventListener(ConstMessage.STORE_BROCADE_WEAV_RECEIVE, UpdateStoreMonthRedDot);
 
-         }
 
-         private void OnClickBtnBack()
 
-         {
 
-             ViewManager.Hide(_curViewName);
 
-             this.Hide();
 
-             //ViewManager.GoBackFrom(typeof(StoreView).FullName);
 
-         }
 
-         private void OnTabChange()
 
-         {
 
-             StoreTabCfg tabCfg = StoreTabCfgArray.Instance.GetCfg(_ui.m_comTab.m_c1.selectedIndex);
 
-             if (tabCfg == null) return;
 
-             if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(tabCfg.functionId))
 
-             {
 
-                 _ui.m_comTab.m_c1.selectedIndex = _ui.m_comTab.m_c1.previsousIndex;
 
-             }
 
-             _curTabIndex = _ui.m_comTab.m_c1.selectedIndex;
 
-             if (tabCfg.functionId == ConstFunctionId.STORE_ARENA)
 
-             {
 
-                 _ui.m_listSubTab.numItems = _arenaSubTab.Count;
 
-             }
 
-             else
 
-             {
 
-                 _storeTabCfgs.Clear();
 
-                 if (tabCfg.index == ConstStoreTabId.STORE_GIFT_BAG)
 
-                 {
 
-                     for (int i = 0; i < tabCfg.subTabArr.Length; i++)
 
-                     {
 
-                         int menu2 = int.Parse(tabCfg.subTabArr[i][1]);
 
-                         if (menu2 == ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY)
 
-                         {
 
-                             if (!ShopDataManager.Instance.GetShopActivityIsShow()) continue;
 
-                         }
 
-                         _storeTabCfgs.Add(tabCfg.subTabArr[i]);
 
-                     }
 
-                 }
 
-                 else
 
-                 {
 
-                     _storeTabCfgs = new List<string[]>(tabCfg.subTabArr);
 
-                 }
 
-                 _ui.m_listSubTab.numItems = _storeTabCfgs.Count;
 
-             }
 
-             _ui.m_listSubTab.selectedIndex = 0;
 
-             _curSubTabIndex = 0;
 
-             OnListSubTabChange(_curSubTabIndex);
 
-             UpdateRedDot();
 
-         }
 
-         private void RenderListSubTabItem(int index, GObject obj)
 
-         {
 
-             GButton item = obj.asButton;
 
-             StoreTabCfg tabCfg = StoreTabCfgArray.Instance.GetCfg(_curTabIndex);
 
-             int menu2 = 0;
 
-             if (tabCfg.functionId == ConstFunctionId.STORE_ARENA)
 
-             {
 
-                 item.title = _arenaSubTab[index][0];
 
-                 menu2 = int.Parse(_arenaSubTab[index][1]);
 
-             }
 
-             else
 
-             {
 
-                 item.title = _storeTabCfgs[index][0];
 
-                 menu2 = int.Parse(_storeTabCfgs[index][1]);
 
-             }
 
-             item.data = index;
 
-         }
 
-         private void OnListSubTabClick(EventContext context)
 
-         {
 
-             GObject obj = context.data as GObject;
 
-             int index = (int)obj.data;
 
-             if (index < 0) return;
 
-             OnListSubTabChange(index);
 
-         }
 
-         private void OnListSubTabChange(int index)
 
-         {
 
-             StoreTabCfg tabCfg = StoreTabCfgArray.Instance.GetCfg(_curTabIndex);
 
-             string viewName = "";
 
-             int menu2 = 0;
 
-             if (tabCfg.functionId == ConstFunctionId.STORE_ARENA)
 
-             {
 
-                 menu2 = int.Parse(_arenaSubTab[index][1]);
 
-                 viewName = _arenaSubTab[index][2];
 
-             }
 
-             else
 
-             {
 
-                 menu2 = int.Parse(_storeTabCfgs[index][1]);
 
-                 viewName = _storeTabCfgs[index][2];
 
-             }
 
-             if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(viewName))
 
-             {
 
-                 _ui.m_listSubTab.selectedIndex = _curSubTabIndex;
 
-                 return;
 
-             }
 
-             ViewManager.Hide(_curViewName);
 
-             if (!string.IsNullOrEmpty(viewName) && viewName != "“”")
 
-             {
 
-                 ViewManager.Show("GFGGame." + viewName, menu2);
 
-             }
 
-             _curSubTabIndex = index;
 
-             _curViewName = "GFGGame." + viewName;
 
-         }
 
-         private void UpdateRedDot()
 
-         {
 
-             RedDotController.Instance.SetComRedDot(_ui.m_comTab.m_btn0.target, RedDotDataManager.Instance.GetChargeAddUpRewardRed());
 
-             for (int i = 0; i < _ui.m_listSubTab.numItems; i++)
 
-             {
 
-                 RedDotController.Instance.SetComRedDot(_ui.m_listSubTab.GetChildAt(i).asCom, false);
 
-             }
 
-             if (_ui.m_comTab.m_c1.selectedIndex == ConstStoreTabId.STORE_CHARGE)
 
-             {
 
-                 RedDotController.Instance.SetComRedDot(_ui.m_listSubTab.GetChildAt(ConstStoreSubId.STORE_CHARGE_ADDUP).asCom, RedDotDataManager.Instance.GetChargeAddUpRewardRed());
 
-             }
 
-             UpdateStoreMonthRedDot();
 
-             RedDotController.Instance.SetComRedDot(_ui.m_comTab.m_btn2.target, RedDotDataManager.Instance.GetGiftBagRewardRed());
 
-             if (_ui.m_comTab.m_c1.selectedIndex == ConstStoreTabId.STORE_GIFT_BAG)
 
-             {
 
-                 RedDotController.Instance.SetComRedDot(_ui.m_listSubTab.GetChildAt(ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY).asCom, RedDotDataManager.Instance.GetGiftBagRewardRed());
 
-             }
 
-         }
 
-         //月卡红点刷新
 
-         private void UpdateStoreMonthRedDot()
 
-         {
 
-             RedDotController.Instance.SetComRedDot(_ui.m_comTab.m_btn1.target, RedDotDataManager.Instance.GetGoldCardRewardRed() || RedDotDataManager.Instance.GetBlackCardRewardRed() || RedDotDataManager.Instance.GetBlackCardClothingRed()
 
-                 || RedDotDataManager.Instance.GetStoreBrocadeWeavRewardRed());
 
-             if (_ui.m_comTab.m_c1.selectedIndex == ConstStoreTabId.STORE_MONTH_CARD)
 
-             {
 
-                 RedDotController.Instance.SetComRedDot(_ui.m_listSubTab.GetChildAt(ConstStoreSubId.STORE_MONTH_GOLD_CARD).asCom, RedDotDataManager.Instance.GetGoldCardRewardRed());
 
-                 RedDotController.Instance.SetComRedDot(_ui.m_listSubTab.GetChildAt(ConstStoreSubId.STORE_MONTH_BLACK_CARD).asCom, RedDotDataManager.Instance.GetBlackCardRewardRed() || RedDotDataManager.Instance.GetBlackCardClothingRed());
 
-                 RedDotController.Instance.SetComRedDot(_ui.m_listSubTab.GetChildAt(ConstStoreSubId.STORE_MONTH_BROCADE_WEAV).asCom, RedDotDataManager.Instance.GetStoreBrocadeWeavRewardRed());
 
-             }
 
-         }
 
-     }
 
- }
 
 
  |