1234567891011121314151617181920212223242526272829303132333435363738 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using XRTool.Util;
- public class PdfList : UnitySingleton<PdfList>
- {
- 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<PdfManager>().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);
- }
- }
- }
- }
|