using System; using ET; using FairyGUI; 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; _ui.m_comBg.GetChild("btnClose").asCom.onClick.Add(Hide); _ui.m_list.itemRenderer = RenderListItem; } protected override void AddEventListener() { base.AddEventListener(); } protected override void OnShown() { base.OnShown(); if (TimeHelper.ClientNow() < TimeUtil.GetCurDayTime(GlobalCfgArray.globalCfg.refreshTime)) { if (DateTime.Now.Month == 1) { _month = 12; } else { _month = DateTime.Now.Month - 1; } } else { _month = DateTime.Now.Month; } MonthlyCardCfg cardCfg = MonthlyCardCfgArray.Instance.GetCfg(MonthCardType.BlackGold); _ui.m_list.numItems = cardCfg.clothesIdArr.Length; } protected override void OnHide() { base.OnHide(); } protected override void RemoveEventListener() { base.RemoveEventListener(); } private void RenderListItem(int index, GObject obj) { MonthlyCardCfg cardCfg = MonthlyCardCfgArray.Instance.GetCfg(MonthCardType.BlackGold); ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cardCfg.clothesIdArr[index]); UI_ListBlackRewardtem item = UI_ListBlackRewardtem.Proxy(obj); item.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg); item.m_txtMonth.text = string.Format("{0}月", NumberUtil.GetChiniseNumberText(index + 1)); bool isCurMonth = index + 1 == _month; item.m_imgMask.visible = !isCurMonth; item.m_grpMonth.visible = isCurMonth; item.m_grpName.visible = isCurMonth; if (item.target.data == null) { item.target.onClick.Add(OnBtnGetClick); } item.target.data = _month; UI_ListBlackRewardtem.ProxyEnd(); } private void OnBtnGetClick(EventContext context) { GObject obj = context.sender as GObject; int month = (int)obj.data; } } }