1234567891011121314151617181920212223242526272829303132333435363738 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using XRTool.Util;
- public class Mp4List : UnitySingleton<Mp4List>
- {
- public GameObject mp4Item;
- public void AddItem(FileConfig fileConfig)
- {
- if (RoomFile.Instance.FilePrefabConfigList.Contains(fileConfig))
- {
- RoomFile.IfFilePrefabConfigListAction?.Invoke(fileConfig);
- }
- else
- {
- RoomFile.Instance.FilePrefabConfigList.Add(fileConfig);
- GameObject obj = Instantiate(mp4Item, transform) as GameObject;
- obj.transform.GetComponent<Mp4Item>().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++)
- {
- transform.GetChild(i).GetComponent<Mp4Item>().hideBtn.onClick.Invoke();
- }
- }
- }
- }
|