using SC.XR.Unity; using System.Collections; using System.Collections.Generic; using UnityEngine; public class UIModelManager : SingletonMono { public bool isinit = true; public string loadModelName = ""; public List listItem; public GameObject ziYuanKuObj; public GameObject button; public Transform point; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if (OpenXRCamera.Instance.head != null && !ziYuanKuObj.activeSelf) { transform.position = new Vector3(point.position.x, 1.5f, point.position.z); transform.eulerAngles = new Vector3(0, point.eulerAngles.y, 0); } } public void CreateModel( string modelName) { ZYKOnClick(false); string id = Random.Range(1000, 9999).ToString() + SynchronizeManager.Instance.modelNume++.ToString(); Vector3 pos = OpenXRCamera.Instance.head.forward * 2f + OpenXRCamera.Instance.head.position; TransformData tranformData = new TransformData(pos, Vector3.zero, Vector3.one); ModelData data = new ModelData(id, modelName, tranformData, false, false, false); GameObject modelc = GameObject.Instantiate(Resources.Load("ModelC")); GameObject model = GameObject.Instantiate(Resources.Load(data.name)); modelc.GetComponent().AddModel(model.transform); ModelSynchronize modelSync = modelc.GetComponent(); modelSync.Init(data); SynchronizeManager.Instance.CreateModel(data); SynchronizeManager.Instance.AddModelSynchronize(modelSync); } public void CreateModel() { for (int i = 0; i < listItem.Count; i++) { listItem[i].blueImage.SetActive(false); } if (loadModelName != "") CreateModel(loadModelName); loadModelName = ""; } public void DesModel( string ModelId ) { SynchronizeManager.Instance.DesModel(ModelId); } public void ZYKOnClick( bool state ) { ziYuanKuObj.SetActive(state); button.SetActive(!state); } }