ActivityGetYuanXiaoTaskView.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System.Collections;
  2. using UnityEngine;
  3. using UI.ActivityGetYuanXiao;
  4. using FairyGUI;
  5. using System.Collections.Generic;
  6. namespace GFGGame
  7. {
  8. public class ActivityGetYuanXiaoTaskView : BaseWindow
  9. {
  10. private UI_ActivityGetYuanXiaoTaskUI _ui;
  11. public override void Dispose()
  12. {
  13. if (_ui != null)
  14. {
  15. _ui.Dispose();
  16. _ui = null;
  17. }
  18. base.Dispose();
  19. }
  20. protected override void OnInit()
  21. {
  22. base.OnInit();
  23. packageName = UI_ActivityGetYuanXiaoTaskUI.PACKAGE_NAME;
  24. _ui = UI_ActivityGetYuanXiaoTaskUI.Create();
  25. viewCom = _ui.target;
  26. viewCom.Center();
  27. viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
  28. modal = true;
  29. _ui.m_itemList.itemRenderer = ListRenderer;
  30. }
  31. protected override void OnShown()
  32. {
  33. base.OnShown();
  34. _ui.m_itemList.numItems = PickUpGameArray.Instance.dataArray.Length;
  35. _ui.m_itemList.scrollPane.ScrollTop();
  36. }
  37. private void ListRenderer(int index, GObject gObject)
  38. {
  39. UI_taskItem item = UI_taskItem.Proxy(gObject);
  40. item.m_c1.selectedIndex = 0;
  41. item.m_desc.text = "";
  42. item.m_rewardList.data = index;
  43. List<ItemData> itemDatas = ItemUtil.CreateItemDataList(PickUpGameArray.Instance.dataArray[index].bonusWinArr);
  44. item.m_rewardList.numItems = itemDatas.Count;
  45. for (int i = 0; i < itemDatas.Count; i++)
  46. {
  47. GObject obj = item.m_rewardList.GetChildAt(i);
  48. ItemData reward = itemDatas[i];
  49. if (obj.data == null)
  50. {
  51. obj.data = new ItemView(obj as GComponent);
  52. }
  53. (obj.data as ItemView).SetData(reward);
  54. }
  55. UI_taskItem.ProxyEnd();
  56. }
  57. }
  58. }