| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 | using System;using ET;using FairyGUI;using Hutool;using UI.Store;using UI.CommonGame;namespace GFGGame{    public class StoreBlackCardRewardView : BaseWindow    {        private UI_StoreBlackCardRewardUI _ui;        private int _month;        private int _day;        public override void Dispose()        {            if (_ui != null)            {                _ui.Dispose();                _ui = null;            }            base.Dispose();        }        protected override void OnInit()        {            base.OnInit();            packageName = UI_StoreBlackCardRewardUI.PACKAGE_NAME;            _ui = UI_StoreBlackCardRewardUI.Create();            this.viewCom = _ui.target;            this.viewCom.Center();            this.modal = true;            viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;            this.bringToFontOnClick = false;            _ui.m_list.itemRenderer = RenderListItem;            _ui.m_btnClose.onClick.Add(Hide);        }        protected override void AddEventListener()        {            base.AddEventListener();        }        protected override void OnShown()        {            base.OnShown();            _month = TimeUtil.GetCurMonth();            _ui.m_list.numItems = MonthlyCardClothesCfgArray.Instance.GetCfgsByyear(TimeUtil.GetCurYear()).Count;        }        protected override void OnHide()        {            base.OnHide();        }        protected override void RemoveEventListener()        {            base.RemoveEventListener();        }        private void RenderListItem(int index, GObject obj)        {            UI_ListBlackRewardtem item = UI_ListBlackRewardtem.Proxy(obj);                      MonthlyCardClothesCfg clothesCfg = MonthlyCardClothesCfgArray.Instance.GetCfgsByyear(TimeUtil.GetCurYear())[index];            if (clothesCfg.clothesArr.Length == 0)            {                item.m_showItemType.selectedIndex = 1;            }            else {                item.m_showItemType.selectedIndex = 0;                ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(clothesCfg.clothesArr[0]);                item.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);                item.m_txtMonth.text = string.Format("{0}月", clothesCfg.month);                bool isCurMonth = clothesCfg.month == _month;                item.m_imgMask.visible = !isCurMonth;                item.m_grpMonth.visible = isCurMonth;                item.m_grpName.visible = isCurMonth;                item.m_imggot.visible = MathUtil.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.MonthCardExclusiveClothesMouth), clothesCfg.month);                if (item.target.data == null)                {                    item.target.onClick.Add(OnBtnGetClick);                }                item.target.data = clothesCfg.month;            }            UI_ListBlackRewardtem.ProxyEnd();        }        private void OnBtnGetClick(EventContext context)        {            GObject obj = context.sender as GObject;            int month = (int)obj.data;            if (month < _month)            {                PromptController.Instance.ShowFloatTextPrompt("逾期单品不可领取");//奖励不可领                return;            }            if (month > _month)            {                PromptController.Instance.ShowFloatTextPrompt("领取时间未到");                return;            }            if (MathUtil.isBitSet(GameGlobal.myNumericComponent.GetAsInt(NumericType.MonthCardExclusiveClothesMouth), month))            {                PromptController.Instance.ShowFloatTextPrompt("奖励已领取");                return;            }            if (GameGlobal.myNumericComponent.GetAsLong(NumericType.MonthCardBlackGoldEndTime) < TimeHelper.ServerNow())            {                PromptController.Instance.ShowFloatTextPrompt("开通福气卡可领");                return;            }            ShopSProxy.ReqGetMonthCardItem(month).Coroutine();        }    }}
 |