|
@@ -6,17 +6,15 @@ using ET;
|
|
|
|
|
|
namespace GFGGame
|
|
namespace GFGGame
|
|
{
|
|
{
|
|
|
|
+
|
|
public class StoreView : BaseWindow
|
|
public class StoreView : BaseWindow
|
|
{
|
|
{
|
|
- private Dictionary<int, Dictionary<int, List<string>>> _tabDic = new Dictionary<int, Dictionary<int, List<string>>>();
|
|
|
|
- private Dictionary<int, List<string>> _subTabChargeDic = new Dictionary<int, List<string>>();
|
|
|
|
- private Dictionary<int, List<string>> _subTabGiftBagDic = new Dictionary<int, List<string>>();
|
|
|
|
- private Dictionary<int, List<string>> _subTabMonthCardDic = new Dictionary<int, List<string>>();
|
|
|
|
- private Dictionary<int, List<string>> _subTabExchangeDic = new Dictionary<int, List<string>>();
|
|
|
|
- private Dictionary<int, List<string>> _subTabArenaDic = new Dictionary<int, List<string>>();
|
|
|
|
-
|
|
|
|
private UI_StoreUI _ui;
|
|
private UI_StoreUI _ui;
|
|
private ValueBarController _valueBarController;
|
|
private ValueBarController _valueBarController;
|
|
|
|
+ private List<List<string>> _arenaSubTab = new List<List<string>>();
|
|
|
|
+ private int _curTabIndex = 0;
|
|
|
|
+ private int _curSubTabIndex = 0;
|
|
|
|
+ private string _curViewName = "";
|
|
|
|
|
|
public override void Dispose()
|
|
public override void Dispose()
|
|
{
|
|
{
|
|
@@ -30,6 +28,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
_ui.Dispose();
|
|
_ui.Dispose();
|
|
}
|
|
}
|
|
|
|
+ _arenaSubTab.Clear();
|
|
_ui = null;
|
|
_ui = null;
|
|
base.Dispose();
|
|
base.Dispose();
|
|
}
|
|
}
|
|
@@ -42,28 +41,45 @@ namespace GFGGame
|
|
this.viewCom = _ui.target;
|
|
this.viewCom = _ui.target;
|
|
isfullScreen = true;
|
|
isfullScreen = true;
|
|
|
|
|
|
- _tabDic[0] = _subTabChargeDic;
|
|
|
|
- _tabDic[1] = _subTabGiftBagDic;
|
|
|
|
- _tabDic[2] = _subTabMonthCardDic;
|
|
|
|
- _tabDic[3] = _subTabExchangeDic;
|
|
|
|
- _tabDic[4] = _subTabArenaDic;
|
|
|
|
-
|
|
|
|
- _subTabChargeDic[0] = new List<string>() { "充值", "累计充值" };//充值
|
|
|
|
- _subTabGiftBagDic[0] = new List<string>() { "活动", "限时", "精选", "热销" };//礼包
|
|
|
|
- _subTabMonthCardDic[0] = new List<string>() { "金卡", "黑金卡" };//月卡
|
|
|
|
- _subTabExchangeDic[0] = new List<string>() { "画廊商城" };//兑换
|
|
|
|
- _subTabArenaDic[0] = new List<string>() { "道具" };//竞技场
|
|
|
|
|
|
+ // _tabDic[0] = _subTabChargeDic;
|
|
|
|
+ // _tabDic[1] = _subTabGiftBagDic;
|
|
|
|
+ // _tabDic[2] = _subTabMonthCardDic;
|
|
|
|
+ // _tabDic[3] = _subTabExchangeDic;
|
|
|
|
+ // _tabDic[4] = _subTabArenaDic;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // _subTabChargeDic[0] = new List<object>() { "充值", "累计充值" };//充值
|
|
|
|
+ // _subTabGiftBagDic[0] = new List<object>() { "活动", "限时", "精选", "热销" };//礼包
|
|
|
|
+ // _subTabMonthCardDic[0] = new List<object>() { "金卡", "黑金卡" };//月卡
|
|
|
|
+ // _subTabExchangeDic[0] = new List<object>() { "画廊商城" };//兑换
|
|
|
|
+ // _subTabArenaDic[0] = new List<object>();//竞技场
|
|
|
|
+
|
|
|
|
+ // _subTabChargeDic[1] = new List<object>() { "RechargeStoreView", "" };//充值
|
|
|
|
+ // _subTabGiftBagDic[1] = new List<object>() { "GiftBagBuyView", "", "", "" };//礼包
|
|
|
|
+ // _subTabMonthCardDic[1] = new List<object>() { "", "" };//月卡
|
|
|
|
+ // _subTabExchangeDic[1] = new List<object>() { "ItemExchangeView", "" };//兑换
|
|
|
|
+ // _subTabArenaDic[1] = new List<object>();//竞技场
|
|
|
|
+
|
|
|
|
+ // _subTabChargeDic[2] = new List<object>() { null, null };//充值
|
|
|
|
+ // _subTabGiftBagDic[2] = new List<object>() { null, null, null, null };//礼包
|
|
|
|
+ // _subTabMonthCardDic[2] = new List<object>() { null, null };//月卡
|
|
|
|
+ // _subTabExchangeDic[2] = new List<object>() { null, null };//兑换
|
|
|
|
+ // _subTabArenaDic[2] = new List<object>();//竞技场
|
|
|
|
+
|
|
|
|
+ StoreTabCfg arenaTab = StoreTabCfgArray.Instance.GetCfgByfunctionId(ConstFunctionId.STORE_ARENA);
|
|
|
|
+ _arenaSubTab.Add(new List<string>() { arenaTab.subTabArr[0][0], arenaTab.subTabArr[0].Length > 2 ? arenaTab.subTabArr[0][1] : "" });
|
|
|
|
+ for (int i = ArenaDataManager.Instance.SeasonId; i > 0; i--)
|
|
|
|
+ {
|
|
|
|
+ _arenaSubTab.Add(new List<string>() { string.Format("第{0}赛季", i), "" });
|
|
|
|
+ }
|
|
|
|
|
|
- _subTabChargeDic[1] = new List<string>() { "RechargeStoreView" };//充值
|
|
|
|
- _subTabGiftBagDic[1] = new List<string>() { "GiftBagBuyView" };//礼包
|
|
|
|
- _subTabMonthCardDic[1] = new List<string>() { };//月卡
|
|
|
|
- _subTabExchangeDic[1] = new List<string>() { "ItemExchangeView" };//兑换
|
|
|
|
- _subTabArenaDic[1] = new List<string>() { "" };//竞技场
|
|
|
|
|
|
+ _valueBarController = new ValueBarController(_ui.m_valueBar);
|
|
|
|
+ _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("sc_beijing");
|
|
|
|
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
-
|
|
|
|
- _valueBarController = new ValueBarController(_ui.m_valueBar);
|
|
|
|
- _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("scsc_bjbj");
|
|
|
|
|
|
+ _ui.m_comTab.m_c1.onChanged.Add(OnTabChange);
|
|
|
|
+ _ui.m_listSubTab.itemRenderer = RenderListSubTabItem;
|
|
|
|
+ _ui.m_listSubTab.onClickItem.Add(OnListSubTabClick);
|
|
|
|
|
|
}
|
|
}
|
|
protected override void AddEventListener()
|
|
protected override void AddEventListener()
|
|
@@ -73,16 +89,30 @@ namespace GFGGame
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
{
|
|
{
|
|
base.OnShown();
|
|
base.OnShown();
|
|
-
|
|
|
|
_valueBarController.OnShown();
|
|
_valueBarController.OnShown();
|
|
|
|
+ //this.viewData[functionId][subTabIndex]
|
|
|
|
+ string functionId = this.viewData == null ? "" : (this.viewData as object[])[0].ToString();
|
|
|
|
|
|
|
|
+ StoreTabCfg tabCfg = StoreTabCfgArray.Instance.GetCfgByfunctionId(functionId);
|
|
|
|
+ _curTabIndex = tabCfg == null ? 1 : tabCfg.index;
|
|
|
|
+ _ui.m_comTab.m_c1.selectedIndex = _curTabIndex;
|
|
|
|
+ _ui.m_comTab.target.scrollPane.SetPercX((float)_curTabIndex / (float)StoreTabCfgArray.Instance.dataArray.Length, false);
|
|
|
|
|
|
|
|
+ _curSubTabIndex = this.viewData == null ? 0 : (int)(this.viewData as object[])[1];
|
|
|
|
+
|
|
|
|
+ if (_ui.m_listSubTab.numItems > _curSubTabIndex)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_listSubTab.selectedIndex = _curSubTabIndex;
|
|
|
|
+ _ui.m_listSubTab.ScrollToView(_curSubTabIndex);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
protected override void OnHide()
|
|
{
|
|
{
|
|
base.OnHide();
|
|
base.OnHide();
|
|
_valueBarController.OnHide();
|
|
_valueBarController.OnHide();
|
|
|
|
+ _ui.m_comTab.m_c1.selectedIndex = 0;
|
|
|
|
+ _ui.m_listSubTab.selectedIndex = 0;
|
|
|
|
|
|
}
|
|
}
|
|
protected override void RemoveEventListener()
|
|
protected override void RemoveEventListener()
|
|
@@ -95,7 +125,61 @@ namespace GFGGame
|
|
this.Hide();
|
|
this.Hide();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void OnTabChange()
|
|
|
|
+ {
|
|
|
|
+ StoreTabCfg tabCfg = StoreTabCfgArray.Instance.GetCfg(_curTabIndex);
|
|
|
|
+ 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 (_curTabIndex == 0) return;
|
|
|
|
+ if (tabCfg.functionId == ConstFunctionId.STORE_ARENA)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_listSubTab.numItems = _arenaSubTab.Count;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ _ui.m_listSubTab.numItems = tabCfg.subTabArr.Length;
|
|
|
|
+ }
|
|
|
|
+ _ui.m_listSubTab.selectedIndex = 0;
|
|
|
|
+ _curSubTabIndex = 0;
|
|
|
|
+ }
|
|
|
|
+ private void RenderListSubTabItem(int index, GObject obj)
|
|
|
|
+ {
|
|
|
|
+ GButton item = obj.asButton;
|
|
|
|
+ StoreTabCfg tabCfg = StoreTabCfgArray.Instance.GetCfg(_curTabIndex);
|
|
|
|
+ if (tabCfg.functionId == ConstFunctionId.STORE_ARENA)
|
|
|
|
+ {
|
|
|
|
+ item.title = _arenaSubTab[index][0];
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ item.title = tabCfg.subTabArr[index][0];
|
|
|
|
+ }
|
|
|
|
+ item.data = index;
|
|
|
|
+ }
|
|
|
|
+ private void OnListSubTabClick(EventContext context)
|
|
|
|
+ {
|
|
|
|
+ GObject obj = context.data as GObject;
|
|
|
|
+ int index = (int)obj.data;
|
|
|
|
+ StoreTabCfg tabCfg = StoreTabCfgArray.Instance.GetCfg(_curTabIndex);
|
|
|
|
+
|
|
|
|
+ string viewName = tabCfg.subTabArr[index].Length > 2 ? tabCfg.subTabArr[index][1] : "";
|
|
|
|
+ if (!FunctionOpenDataManager.Instance.CheckIsFunOpenById(viewName))
|
|
|
|
+ {
|
|
|
|
+ _ui.m_listSubTab.selectedIndex = _curSubTabIndex;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ ViewManager.Hide("GFGGame." + _curViewName);
|
|
|
|
+ if (!string.IsNullOrEmpty(viewName))
|
|
|
|
+ {
|
|
|
|
+ ViewManager.Show("GFGGame." + viewName, index);
|
|
|
|
+ }
|
|
|
|
+ _curSubTabIndex = index;
|
|
|
|
+ _curViewName = viewName;
|
|
|
|
|
|
|
|
+ }
|
|
private void UpdateRedDot()
|
|
private void UpdateRedDot()
|
|
{
|
|
{
|
|
|
|
|