123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class EditorPanel : MonoBehaviour
- {
- /// <summary>
- /// 景点
- /// </summary>
- private UISpoitsPanel m_SpoitsPanel;
- /// <summary>
- /// 素材面板
- /// </summary>
- private UIMaterialsPanel m_MaterialsPanel;
- /// <summary>
- /// 添加素材面板
- /// </summary>
- private UIAddMaterialPanel m_AddMaterialPanel;
- /// <summary>
- /// 素材编辑面板
- /// </summary>
- private UIEditorPanel m_EditorPanel;
- // private UIAnchorsPanel m_AnchorsPanel;
- /// <summary>
- /// 当前触发的景点名称
- /// </summary>
- private string m_SpoitName;
- private void Awake()
- {
- m_SpoitsPanel = transform.Find("UISpoits").gameObject.AddComponent<UISpoitsPanel>();
- m_MaterialsPanel = transform.Find("UIMaterials").gameObject.AddComponent<UIMaterialsPanel>();
- m_MaterialsPanel.EditorPanel = this;
- // m_AnchorsPanel = transform.Find("UIAnchor").gameObject.GetComponent<UIAnchorsPanel>();
- m_AddMaterialPanel = transform.Find("UIAddMaterial").gameObject.AddComponent<UIAddMaterialPanel>();
- m_AddMaterialPanel.EditorPanel = this;
- m_AddMaterialPanel.OnClickAddMatBtn += OnClickAddMatBtn;
- m_EditorPanel = transform.Find("UIEditor").gameObject.GetComponent<UIEditorPanel>();
- 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<ObjectValue> 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;
- }
- }
|