DailyLoginView.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Collections.Generic;
  2. using FairyGUI;
  3. using UI.DailyLogin;
  4. using UnityEngine;
  5. namespace GFGGame
  6. {
  7. public class DailyLoginView : BaseWindow
  8. {
  9. private UI_DailyLoginUI _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_DailyLoginUI.PACKAGE_NAME;
  19. _ui = UI_DailyLoginUI.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_list.onClickItem.Add(OnListItemClick);
  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 async void OnListItemClick(EventContext context)
  43. {
  44. int id = (int)(context.sender as GObject).data;
  45. bool result = await ActivitySProxy.ReqGetDailyLoginRewards(id);
  46. if (result)
  47. {
  48. _ui.m_list.numItems = _cfgs.Count;
  49. }
  50. }
  51. }
  52. }