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 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 (API_GSXR_Slam.GSXR_Get_Head() != null && !ziYuanKuObj.activeSelf) { transform.position = new Vector3(point.position.x, 0, 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 = API_GSXR_Slam.GSXR_Get_Head().forward * 2f + API_GSXR_Slam.GSXR_Get_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() { 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); } }