XunJianLieBiaoWindow.cs 1016 B

123456789101112131415161718192021222324252627282930313233
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using static XunJianDataManager;
  5. public class XunJianLieBiaoWindow : WindowSingleton<XunJianLieBiaoWindow>
  6. {
  7. public GameObject parentGo;
  8. public List<GameObject> itemList;
  9. protected override void OnStart()
  10. {
  11. base.OnStart();
  12. GameObject liebiao = WindowsManager.Instance.GetPrefab(WindowConfig.windowType.XunJian, "liebiao");
  13. XunJianDataManager.Instance.GetXunJianList((List<XunJianListData> data) => {
  14. for (int i = 0; i < data.Count; i++)
  15. {
  16. GameObject itemGo = GameObject.Instantiate(liebiao, parentGo.transform);
  17. XunJianLieBiaoItem item = itemGo.GetComponent<XunJianLieBiaoItem>();
  18. item.updateData(data[i]);
  19. itemList.Add(itemGo);
  20. }
  21. });
  22. }
  23. public void RemoveAll()
  24. {
  25. for (int i = 0; i < itemList.Count; i++)
  26. {
  27. Destroy(itemList[i]);
  28. }
  29. }
  30. }