using System.Collections.Generic; using FairyGUI; using UI.CommonGame; using UI.DailyTask; using UnityEngine; namespace GFGGame { public class DailyTaskRewardView : BaseWindow { private UI_DailyTaskRewardUI _ui; private DailyActiveRewardCfg _cfg; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } 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; _ui.m_txtDesc.text = string.Format("满足{0}活跃度可领取", _cfg.count); } protected override void OnHide() { base.OnHide(); } private void ListItemRender(int index, GObject obj) { UI_ComItem item = UI_ComItem.Proxy(obj); ItemData reward = ItemUtil.createItemData(_cfg.rewardsArr[index]); if (obj.data == null) { obj.data = new ItemView(obj as GComponent); } (obj.data as ItemView).SetData(reward); UI_ComItem.ClearProxy(); } } }