using System.Collections; using System.Collections.Generic; using UnityEngine; using XRTool.Util; public class PdfList : UnitySingleton { public GameObject pdfItem; public void AddItem(FileConfig fileConfig) { if (RoomFile.Instance.FilePrefabConfigList.Contains(fileConfig)) { RoomFile.IfFilePrefabConfigListAction?.Invoke(fileConfig); } else { RoomFile.Instance.FilePrefabConfigList.Add(fileConfig); GameObject obj = Instantiate(pdfItem, transform) as GameObject; obj.transform.GetChild(0).transform.GetComponent().Init(fileConfig); Transform filePos = RoomFile.Instance.GetFilePos(); obj.transform.eulerAngles = filePos.eulerAngles; obj.transform.position = filePos.position; RoomFile.IfFilePrefabConfigListAction?.Invoke(fileConfig); } } public void DeleteAll() { if (transform.childCount > 0) { for (int i = 0; i < transform.childCount; i++) { Destroy(transform.GetChild(i).gameObject); } } } }