using ShadowStudio.Model; using System.Collections; using System.Collections.Generic; using UnityEngine; using XRTool.Util; using static LangChaoRommMinIo; public class ModelList : UnitySingleton { public void AddItem(FileConfig fileConfig) { if (RoomFile.Instance.FilePrefabConfigList.Contains(fileConfig)) { RoomFile.IfFilePrefabConfigListAction?.Invoke(fileConfig); } else { RoomFile.Instance.FilePrefabConfigList.Add(fileConfig); string url = fileConfig.Url; LangChaoRommMinIo.Instance.getFile(MQTTManager.Instance.roomId, fileConfig.Bucket, fileConfig.ObjectName, (RoomFileData rfd) => { Debug.Log("rfd==>" + rfd.url); Debug.Log("rfd==>" + rfd.bytes.Length); url = rfd.url; }); if (!url.Contains("http")) { url = "https://" + fileConfig.Url; } ArtInfo artInfo = new ArtInfo(); artInfo.ArtId = "ArtId" + UnityEngine.Random.Range(10000000, 99999999).ToString(); artInfo.ArtName = fileConfig.FileName; artInfo.Url = url; artInfo.ArtType = ArtType.Model; artInfo.InstaceType = InstaceType.ExtralURLDownload; ArtHandler handler = ArtInfoMgr.Instance.CreateArtHandler(artInfo); var container = handler.CreateArt(); Transform objTran = container.GetInstace().transform; objTran.SetParent(this.transform); //objTran.position = RoomFile.Instance.ModelPoint.position + new Vector3(RoomFile.Instance.fileIndex * 1f, 0, 0); //objTran.eulerAngles = RoomFile.Instance.Mp4Point.eulerAngles; Transform filePos = RoomFile.Instance.GetFilePos(); objTran.transform.eulerAngles = filePos.eulerAngles; objTran.transform.position = filePos.position; ModelItem modelItem = objTran.GetComponent(); modelItem.Init(fileConfig); RoomFile.IfFilePrefabConfigListAction?.Invoke(fileConfig); } } public void DeleteAll() { if (transform.childCount > 0) { for (int i = 0; i < transform.childCount; i++) { Destroy(transform.GetChild(i).gameObject); } } } }