1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using XRTool.Util;
- public class PngJpgList : UnitySingleton<PngJpgList>
- {
- public GameObject pngJpgItem;
- public void AddItem(FileConfig fileConfig)
- {
- if (RoomFile.Instance.FilePrefabConfigList.Contains(fileConfig))
- {
- RoomFile.IfFilePrefabConfigListAction?.Invoke(fileConfig);
- }
- else
- {
- RoomFile.Instance.FilePrefabConfigList.Add(fileConfig);
- GameObject obj = Instantiate(pngJpgItem, transform) as GameObject;
- obj.transform.GetComponent<PngJpgItem>().Init(fileConfig);
- obj.transform.position = RoomFile.Instance.PngJpgPoint.position + new Vector3(0, (- obj.transform.GetSiblingIndex() * 0.013f), 0f);
- obj.transform.eulerAngles = RoomFile.Instance.PngJpgPoint.eulerAngles;
- RoomFile.IfFilePrefabConfigListAction?.Invoke(fileConfig);
- }
- }
- public void DeleteAll()
- {
- if (transform.childCount > 0)
- {
- for (int i = 0; i < transform.childCount; i++)
- {
- Destroy(transform.GetChild(i).gameObject);
- }
- }
- }
- }
|