using System.Collections.Generic; using FairyGUI; using UI.DailyTask; using UnityEngine; namespace GFGGame { public class DailyTaskRewardView : BaseWindow { private UI_DailyTaskRewardUI _ui; private DailyActiveRewardCfg _cfg; public override void Dispose() { base.Dispose(); } protected override void OnInit() { base.OnInit(); _ui = UI_DailyTaskRewardUI.Create(); this.viewCom = _ui.target; this.viewCom.Center(); this.modal = true; viewAnimationType = EnumViewAnimationType.ZOOM_CENTER; _ui.m_list.itemRenderer = ListItemRender; _ui.m_list.onClickItem.Add(OnClickListReward); } protected override void OnShown() { base.OnShown(); _cfg = this.viewData as DailyActiveRewardCfg; _ui.m_list.numItems = _cfg.rewardsArr.Length; } protected override void OnHide() { base.OnHide(); } private void ListItemRender(int index, GObject obj) { UI_ListItem item = UI_ListItem.Proxy(obj); item.target.data = _cfg.rewardsArr[index]; UI_ListItem.ClearProxy(); } private void OnClickListReward(EventContext context) { ItemData data = (context.data as GObject).data as ItemData; GoodsItemTipsController.ShowItemTips(data.id); } } }