Mp4List.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using XRTool.Util;
  5. public class Mp4List : UnitySingleton<Mp4List>
  6. {
  7. public GameObject mp4Item;
  8. public void AddItem(FileConfig fileConfig)
  9. {
  10. if (RoomFile.Instance.FilePrefabConfigList.Contains(fileConfig))
  11. {
  12. RoomFile.IfFilePrefabConfigListAction?.Invoke(fileConfig);
  13. }
  14. else
  15. {
  16. RoomFile.Instance.FilePrefabConfigList.Add(fileConfig);
  17. GameObject obj = Instantiate(mp4Item, transform) as GameObject;
  18. obj.transform.GetComponent<Mp4Item>().Init(fileConfig);
  19. obj.transform.position = RoomFile.Instance.Mp4Point.position + new Vector3(0f, (- obj.transform.GetSiblingIndex() * 0.013f), 0f);
  20. obj.transform.eulerAngles = RoomFile.Instance.Mp4Point.eulerAngles;
  21. RoomFile.IfFilePrefabConfigListAction?.Invoke(fileConfig);
  22. }
  23. }
  24. public void DeleteAll()
  25. {
  26. if (transform.childCount > 0)
  27. {
  28. for (int i = 0; i < transform.childCount; i++)
  29. {
  30. Destroy(transform.GetChild(i).gameObject);
  31. }
  32. }
  33. }
  34. }