using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using XRTool.Util; public class EditorPanel : MonoBehaviour { /// /// 景点 /// public UISpoitsPanel m_SpoitsPanel; /// /// 素材面板 /// public UIMaterialsPanel m_MaterialsPanel; /// /// 添加素材面板 /// public UIAddMaterialPanel m_AddMaterialPanel; /// /// 素材编辑面板 /// public UIEditorPanel m_EditorPanel; // private UIAnchorsPanel m_AnchorsPanel; /// /// 当前触发的景点名称 /// private string m_SpoitName; private void Awake() { // m_SpoitsPanel = transform.Find("UISpoits").gameObject.AddComponent(); // m_MaterialsPanel = transform.Find("UIMaterials").gameObject.AddComponent(); m_MaterialsPanel.EditorPanel = this; // m_AnchorsPanel = transform.Find("UIAnchor").gameObject.GetComponent(); // m_AddMaterialPanel = transform.Find("UIAddMaterial").gameObject.AddComponent(); m_AddMaterialPanel.EditorPanel = this; m_AddMaterialPanel.OnClickAddMatBtn += OnClickAddMatBtn; // m_EditorPanel = transform.Find("UIEditor").gameObject.GetComponent(); m_EditorPanel.OnClickRemoveBtn += onClickRemoveBtn; } private void OnClickAddMatBtn() { m_MaterialsPanel.SaveSpoits(); } private void onClickRemoveBtn(GameObject obj) { m_MaterialsPanel.RemoveMat(obj); } public void Init() { m_AddMaterialPanel.Init(); } public void SetSpoit(SpoitValue spoit) { if (spoit != null) { m_SpoitName = spoit.name; m_SpoitsPanel.SetSpoit(m_SpoitName, true); } else { m_SpoitName = null; m_SpoitsPanel.SetSpoit("", false); } m_MaterialsPanel.SetMaterial(spoit); } public void ClosePanel() { m_SpoitName = null; m_SpoitsPanel.SetSpoit("", false); m_MaterialsPanel.ClosePanel(); } //public void SetSpoit(List spoitObjs) //{ // if (spoitObjs != null) // { // m_SpoitName = spoitObjs[0].Object.name; // m_SpoitsPanel.SetSpoit(m_SpoitName, true); // } // else // { // m_SpoitName = null; // m_SpoitsPanel.SetSpoit(m_SpoitName, false); // } // m_MaterialsPanel.SetMaterial(spoitObjs); //} public void InitObjTransForm() { m_MaterialsPanel.InitObjTransForm(); } public void SaveObjTransForm() { m_MaterialsPanel.SaveMatObj(); } public void ChangeShowUI(bool isShowEditor) { m_EditorPanel.gameObject.SetActive(isShowEditor); m_AddMaterialPanel.gameObject.SetActive(!isShowEditor); } private void OnDestroy() { m_EditorPanel.OnClickRemoveBtn -= onClickRemoveBtn; } private void OnEnable() { TimerMgr.Instance.CreateTimer(()=> { m_SpoitsPanel.gameObject.SetActive(false); m_MaterialsPanel.gameObject.SetActive(false); m_EditorPanel.gameObject.SetActive(false); m_AddMaterialPanel.gameObject.SetActive(false); },0.1f); } }