| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 | 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);            EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);        }        protected override void OnShown()        {            base.OnShown();            _valueBarController.OnShown();            _ui.m_txtDailyMoneyCount.text = "4800";            UpdateView();            UpdateRedDot();        }        protected override void OnHide()        {            base.OnHide();            _valueBarController.OnHide();        }        protected override void RemoveEventListener()        {            base.RemoveEventListener();            EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);            EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateView);        }        private void OnBtnBlackRewardClick()        {            ViewManager.Show<StoreBlackCardRewardView>();        }        private void UpdateView()        {            GetGrowthFundBuy();            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 (!GetGrowthFundBuy())            {                int id = ActivityOpenCfgArray.Instance.GetCfg(3002).paramsArr[0];                ShopSProxy.ReqShopBuy(id).Coroutine();                ShopSProxy.ReqGetGrowthFundInfo().Coroutine();            }        }        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);            _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 (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 bool GetGrowthFundBuy()        {            ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(ActivityOpenCfgArray.Instance.GetCfg(3002).paramsArr[0]);            var remainBuyNum = shopCfg.maxBuyNum - ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id);            if (remainBuyNum == 0)            {                //已售完                _ui.m_btnBuy.m_c1.selectedIndex = 1;                return true;            }            else            {                //未售完                _ui.m_btnBuy.m_c1.selectedIndex = 0;                return false;            }        }        private void UpdateRedDot()        {        }    }}
 |