| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 | using UI.Store;using UI.CommonGame;using FairyGUI;using System.Collections.Generic;using ET;namespace GFGGame{    public class StoreChargeView : BaseWindow    {        private UI_StoreChargeUI _ui;        private ValueBarController _valueBarController;        private List<ShopCfg> _shopCfgs;        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_StoreChargeUI.PACKAGE_NAME;            _ui = UI_StoreChargeUI.Create();            this.viewCom = _ui.target;            isfullScreen = true;            this.clickBlankToClose = false;            _ui.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();            _shopCfgs = ShopCfgArray.Instance.GetCfgsBymenu1Andmenu2(ConstStoreTabId.STORE_CHARGE, ConstStoreSubId.STORE_CHARGE);            _valueBarController.OnShown();            UpdateView();        }        private void UpdateView()        {            _ui.m_list.numItems = _shopCfgs.Count;            ShopViewManager.Instance.UpdateVipProgressCom(_ui.m_comVipLv.target);        }        protected override void OnHide()        {            base.OnHide();            _valueBarController.OnHide();        }        protected override void RemoveEventListener()        {            base.RemoveEventListener();            EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateView);        }        private void ListItemRenderer(int index, GObject obj)        {            ShopCfg shopCfg = _shopCfgs[index];            UI_ListChargeItem item = UI_ListChargeItem.Proxy(obj);            item.m_btnBuy.m_c1.selectedIndex = 1;            item.m_btnBuy.m_txtTitle.text = shopCfg.price.ToString();            if (item.target.data == null)            {                item.target.onClick.Add(OnClickBtnBuy);            }            item.target.data = index;            item.m_txtName.text = string.Format("{0}{1}", shopCfg.itemNum, shopCfg.itemName);            item.m_txtDesc.text = string.Format("首充赠送+{0}{1}", shopCfg.itemNum, shopCfg.itemName);            bool isDouble = ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.id) < shopCfg.doubleTimes;            item.m_grpDouble.visible = isDouble;            item.m_txtDesc.visible = isDouble;            item.m_icon.url = "ui://Store/sc_zizhuan_" + (index + 1);            UI_ListChargeItem.ProxyEnd();        }        private void OnClickBtnBuy(EventContext context)        {            GObject obj = context.sender as GObject;            int index = (int)obj.data;            ShopCfg itemData = _shopCfgs[index];            if (!AntiAddictionController.CheckAntiAddictionRecharge(itemData.price))            {                ShopSProxy.ReqShopBuy(itemData.id, 1).Coroutine();                LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);            }        }    }}
 |