DailyTaskView.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System.Collections.Generic;
  2. using FairyGUI;
  3. using UI.DailyTask;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class DailyTaskView : BaseWindow
  8. {
  9. private UI_DailyTaskUI _ui;
  10. private List<FieldTaskCfg> _cfgs;
  11. public override void Dispose()
  12. {
  13. base.Dispose();
  14. }
  15. protected override void OnInit()
  16. {
  17. base.OnInit();
  18. packageName = UI_DailyTaskUI.PACKAGE_NAME;
  19. _ui = UI_DailyTaskUI.Create();
  20. this.viewCom = _ui.target;
  21. this.viewCom.Center();
  22. this.modal = true;
  23. viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  24. _ui.m_list.itemRenderer = ListItemRender;
  25. _ui.m_listReward.itemRenderer = ListRewardItemRender;
  26. }
  27. protected override void OnShown()
  28. {
  29. base.OnShown();
  30. _cfgs = FieldDataManager.Instance.GetTaskCfgs();
  31. _ui.m_list.numItems = _cfgs.Count;
  32. }
  33. protected override void OnHide()
  34. {
  35. base.OnHide();
  36. }
  37. private void ListItemRender(int index, GObject obj)
  38. {
  39. UI_ListItem item = UI_ListItem.Proxy(obj);
  40. UI_ListItem.ClearProxy();
  41. }
  42. private void ListRewardItemRender(int index, GObject obj)
  43. {
  44. UI_ListRewardItem item = UI_ListRewardItem.Proxy(obj);
  45. UI_ListRewardItem.ClearProxy();
  46. }
  47. }
  48. }