using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;


namespace XGame.Editor.Asset.Processor
{
    [CustomEditor(typeof(AssetsConfig))]
    internal class AssetsConfigInspector: UnityEditor.Editor
    {
        private SerializedProperty m_Script;
        private IAssetsPanel panel;

        private void OnEnable()
        {
            m_Script = serializedObject.FindProperty("m_Script");
            var config = serializedObject.targetObject as AssetsConfig;
            panel = new AssetsConfigPanel(config);
        }
        private void OnDisable()
        {
            panel?.Close();
        }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.Update();

            //展示区域，禁止操作
            EditorGUI.BeginDisabledGroup(true);
            EditorGUILayout.PropertyField(m_Script);
            GUILayout.Space(10);
            EditorGUI.EndDisabledGroup();

            panel?.DrawGUI();
        }
    }
}

