1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- 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();
- _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];
- 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;
- 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;
- }
- }
- }
|