|
@@ -0,0 +1,169 @@
|
|
|
+using UI.Store;
|
|
|
+using UI.CommonGame;
|
|
|
+using FairyGUI;
|
|
|
+using System.Collections.Generic;
|
|
|
+using ET;
|
|
|
+using System;
|
|
|
+
|
|
|
+namespace GFGGame
|
|
|
+{
|
|
|
+ public class StoreGrowthFundView : BaseWindow
|
|
|
+ {
|
|
|
+ private UI_StoreGrowthFundUI _ui;
|
|
|
+ private ValueBarController _valueBarController;
|
|
|
+ private int menu2;
|
|
|
+ private EffectUI _effectUI1;
|
|
|
+
|
|
|
+ public override void Dispose()
|
|
|
+ {
|
|
|
+ EffectUIPool.Recycle(_effectUI1);
|
|
|
+ _effectUI1 = null;
|
|
|
+
|
|
|
+ if (_valueBarController != null)
|
|
|
+ {
|
|
|
+ _valueBarController.Dispose();
|
|
|
+ _valueBarController = null;
|
|
|
+ }
|
|
|
+ if (_ui != null)
|
|
|
+ {
|
|
|
+ _ui.Dispose();
|
|
|
+ }
|
|
|
+ _ui = null;
|
|
|
+ base.Dispose();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnInit()
|
|
|
+ {
|
|
|
+ base.OnInit();
|
|
|
+ packageName = UI_StoreGrowthFundUI.PACKAGE_NAME;
|
|
|
+ _ui = UI_StoreGrowthFundUI.Create();
|
|
|
+ this.viewCom = _ui.target;
|
|
|
+ isfullScreen = true;
|
|
|
+ this.clickBlankToClose = false;
|
|
|
+ this.bringToFontOnClick = false;
|
|
|
+
|
|
|
+ _valueBarController = new ValueBarController(_ui.m_valueBar);
|
|
|
+ _ui.m_list.itemRenderer = ListItemRenderer;
|
|
|
+ _ui.m_btnBuy.target.onClick.Add(OnBtnBuyClick);
|
|
|
+
|
|
|
+ }
|
|
|
+ protected override void AddEventListener()
|
|
|
+ {
|
|
|
+ base.AddEventListener();
|
|
|
+ EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
|
|
|
+
|
|
|
+ }
|
|
|
+ protected override void OnShown()
|
|
|
+ {
|
|
|
+ base.OnShown();
|
|
|
+ _valueBarController.OnShown();
|
|
|
+
|
|
|
+ UpdateView();
|
|
|
+ UpdateRedDot();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void OnHide()
|
|
|
+ {
|
|
|
+ base.OnHide();
|
|
|
+ _valueBarController.OnHide();
|
|
|
+ }
|
|
|
+
|
|
|
+ protected override void RemoveEventListener()
|
|
|
+ {
|
|
|
+ base.RemoveEventListener();
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
|
|
|
+ }
|
|
|
+ private void OnBtnBlackRewardClick()
|
|
|
+ {
|
|
|
+ ViewManager.Show<StoreBlackCardRewardView>();
|
|
|
+ }
|
|
|
+ private void UpdateView()
|
|
|
+ {
|
|
|
+ _ui.m_btnBuy.m_c1.selectedIndex = RedDotDataManager.Instance.GetGrowthFundBuy()?0:1;
|
|
|
+ int count = 0;
|
|
|
+ for(int i = 0;i < GrowthFundCfgArray.Instance.dataArray.Length;i++)
|
|
|
+ {
|
|
|
+ if(RoleDataManager.lvl >= GrowthFundCfgArray.Instance.dataArray[i].level)
|
|
|
+ {
|
|
|
+ count += GrowthFundCfgArray.Instance.dataArray[i].bonusArr[0][1];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ _ui.m_txtGiftBag.text = count.ToString();
|
|
|
+ _ui.m_list.numItems = GrowthFundCfgArray.Instance.dataArray.Length;
|
|
|
+ }
|
|
|
+ private void OnBtnBuyClick()
|
|
|
+ {
|
|
|
+ //是否购买
|
|
|
+ if (RedDotDataManager.Instance.GetGrowthFundBuy())
|
|
|
+ {
|
|
|
+ int id = ActivityOpenCfgArray.Instance.GetCfg(3002).paramsArr[0];
|
|
|
+ ShopSProxy.ReqShopBuy(id).Coroutine();
|
|
|
+ _ui.m_btnBuy.m_c1.selectedIndex = 1;
|
|
|
+ _ui.m_list.numItems = GrowthFundCfgArray.Instance.dataArray.Length;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private async void OnBtnGetClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject obj = context.sender as GObject;
|
|
|
+ int goodsId = (int)obj.data;
|
|
|
+ UI_GrowthFundItemUI item = UI_GrowthFundItemUI.Proxy(_ui.m_list.GetChildAt(goodsId - 1));
|
|
|
+ if(item.m_rewardBtn.m_c1.selectedIndex != 1)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ UI_GrowthFundItemUI.ProxyEnd();
|
|
|
+ bool result = await ShopSProxy.ReqGetGrowthFundReward(3002,goodsId);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ _ui.m_list.numItems = GrowthFundCfgArray.Instance.dataArray.Length;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void ListItemRenderer(int index, GObject obj)
|
|
|
+ {
|
|
|
+ UI_GrowthFundItemUI item = UI_GrowthFundItemUI.Proxy(obj);
|
|
|
+ int num = GrowthFundCfgArray.Instance.dataArray[index].level;
|
|
|
+ item.m_rewardDesc.text = string.Format("等级达{0}级可领",num);
|
|
|
+ item.m_rewardBtn.m_c1.selectedIndex = 1;
|
|
|
+ if (!RedDotDataManager.Instance.GetGrowthFundBuy())
|
|
|
+ {
|
|
|
+ bool isRed = true;
|
|
|
+ if(RoleDataManager.lvl >= num)
|
|
|
+ {
|
|
|
+ foreach (int i in ShopDataManager.Instance.GrowthFundRewardList)
|
|
|
+ {
|
|
|
+ if (i == GrowthFundCfgArray.Instance.dataArray[index].id)
|
|
|
+ {
|
|
|
+ item.m_rewardBtn.m_c1.selectedIndex = 2;
|
|
|
+ isRed = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ item.m_rewardBtn.m_c1.selectedIndex = 0;
|
|
|
+ isRed = false;
|
|
|
+ }
|
|
|
+ RedDotController.Instance.SetComRedDot(item.m_rewardBtn.target, isRed);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ item.m_rewardBtn.m_c1.selectedIndex = 0;
|
|
|
+ RedDotController.Instance.SetComRedDot(item.m_rewardBtn.target, false);
|
|
|
+ }
|
|
|
+ ItemUtil.CreateItemView(GrowthFundCfgArray.Instance.dataArray[index].bonusArr[0], item.m_reward as GComponent);
|
|
|
+ if (item.m_rewardBtn.target.data == null)
|
|
|
+ {
|
|
|
+ item.m_rewardBtn.target.onClick.Add(OnBtnGetClick);
|
|
|
+ }
|
|
|
+ item.m_rewardBtn.target.data = index + 1;
|
|
|
+ UI_GrowthFundItemUI.ProxyEnd();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateRedDot()
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|