123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- 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];
- ItemData reward = new ItemData();
- if (obj.data == null)
- {
- obj.data = new ItemView(obj as GComponent);
- }
- (obj.data as ItemView).SetData(reward);
- UI_ListItem.ClearProxy();
- }
- private void OnClickListReward(EventContext context)
- {
- ItemData data = (context.data as GObject).data as ItemData;
- GoodsItemTipsController.ShowItemTips(data.id);
- }
- }
- }
|