TaskListPanel.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using UnityEngine.UI;
  6. public class TaskListPanel : MonoBehaviour
  7. {
  8. public Button taskTpye_allButton;
  9. public Button taskTpye_dianQiButton;
  10. public Button taskTpye_zhaZhanButton;
  11. public Button taskTpye_diFangButton;
  12. public Button taskTpye_jianZhuButton;
  13. public Button taskTpye_zhuanXiangButton;
  14. public GameObject taskItemPrefab;
  15. public Transform itemContent;
  16. public List<B08_TaskListItem> taskItemList = new List<B08_TaskListItem>();
  17. public GCYWLayer gcywLayer;
  18. private void Awake()
  19. {
  20. }
  21. public void SetData(GCYWLayer baseLayer, int type)
  22. {
  23. gcywLayer = baseLayer;
  24. for (int i = 0; i < taskItemList.Count; i++)
  25. {
  26. Destroy(taskItemList[i].gameObject);
  27. }
  28. taskItemList.Clear();
  29. var taskInfoList = GlobalData.B08TaskListInfos[type].data;
  30. if (taskInfoList != null)
  31. {
  32. for (int j = 0; j < taskInfoList.Length; j++)
  33. {
  34. B08_TaskListItem tempItem = Instantiate(taskItemPrefab, itemContent).GetComponent<B08_TaskListItem>();
  35. tempItem.Init();
  36. tempItem.SetData(gcywLayer, taskInfoList[j], type);
  37. taskItemList.Add(tempItem);
  38. }
  39. }
  40. }
  41. }