DailyTaskRewardView.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Collections.Generic;
  2. using FairyGUI;
  3. using UI.CommonGame;
  4. using UI.DailyTask;
  5. using UnityEngine;
  6. namespace GFGGame
  7. {
  8. public class DailyTaskRewardView : BaseWindow
  9. {
  10. private UI_DailyTaskRewardUI _ui;
  11. private DailyActiveRewardCfg _cfg;
  12. public override void Dispose()
  13. {
  14. base.Dispose();
  15. }
  16. protected override void OnInit()
  17. {
  18. base.OnInit();
  19. _ui = UI_DailyTaskRewardUI.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(OnClickListReward);
  26. }
  27. protected override void OnShown()
  28. {
  29. base.OnShown();
  30. _cfg = this.viewData as DailyActiveRewardCfg;
  31. _ui.m_list.numItems = _cfg.rewardsArr.Length;
  32. _ui.m_txtDesc.text = string.Format("满足{0}活跃度可领取", _cfg.count);
  33. }
  34. protected override void OnHide()
  35. {
  36. base.OnHide();
  37. }
  38. private void ListItemRender(int index, GObject obj)
  39. {
  40. UI_ComItem item = UI_ComItem.Proxy(obj);
  41. ItemData reward = ItemUtil.createItemData(_cfg.rewardsArr[index]);
  42. if (obj.data == null)
  43. {
  44. obj.data = new ItemView(obj as GComponent);
  45. }
  46. (obj.data as ItemView).SetData(reward);
  47. UI_ComItem.ClearProxy();
  48. }
  49. }
  50. }