DailyTaskRewardView.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System.Collections.Generic;
  2. using FairyGUI;
  3. using UI.DailyTask;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class DailyTaskRewardView : BaseWindow
  8. {
  9. private UI_DailyTaskRewardUI _ui;
  10. private DailyActiveRewardCfg _cfg;
  11. public override void Dispose()
  12. {
  13. base.Dispose();
  14. }
  15. protected override void OnInit()
  16. {
  17. base.OnInit();
  18. _ui = UI_DailyTaskRewardUI.Create();
  19. this.viewCom = _ui.target;
  20. this.viewCom.Center();
  21. this.modal = true;
  22. viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  23. _ui.m_list.itemRenderer = ListItemRender;
  24. _ui.m_list.onClickItem.Add(OnClickListReward);
  25. }
  26. protected override void OnShown()
  27. {
  28. base.OnShown();
  29. _cfg = this.viewData as DailyActiveRewardCfg;
  30. _ui.m_list.numItems = _cfg.rewardsArr.Length;
  31. }
  32. protected override void OnHide()
  33. {
  34. base.OnHide();
  35. }
  36. private void ListItemRender(int index, GObject obj)
  37. {
  38. UI_ListItem item = UI_ListItem.Proxy(obj);
  39. item.target.data = _cfg.rewardsArr[index];
  40. UI_ListItem.ClearProxy();
  41. }
  42. private void OnClickListReward(EventContext context)
  43. {
  44. ItemData data = (context.data as GObject).data as ItemData;
  45. GoodsItemTipsController.ShowItemTips(data.id);
  46. }
  47. }
  48. }