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

namespace TFramework
{
    public class TEditor : Editor
    {
        /// <summary>
        /// 控件标签标准宽度
        /// </summary>
        protected virtual float LabelWidth=> EditorGUIUtility.labelWidth;

        /// <summary>
        /// 标记场景中值被改变
        /// </summary>
        public void MarkerChange()
        {
            EditorUtility.SetDirty(target);
            if (EditorApplication.isPlaying) return;

            Component component = target as Component;
            if (component != null && component.gameObject.scene != null)
            {
                EditorSceneManager.MarkSceneDirty(component.gameObject.scene);
            }
        }

        public void DrawGUICopyButon(Rect rect,string v)
        {
            if (GUI.Button(rect,"复制"))
            {
                EditorGUIUtility.systemCopyBuffer = v;
            }
        }

        public void DrawGUILayoutCopyButton(string v)
        {
            if (GUILayout.Button("复制", GUILayout.ExpandWidth(false)))
            {
                EditorGUIUtility.systemCopyBuffer = v;
            }
        }
    }
}
