三国卡牌客户端基础资源仓库
lcy
7 天以前 814f2b70eca0cdc5b8ae07edd7dad9f110ead363
Assets/Editor/UIComponent/TextExEditor.cs
@@ -1,18 +1,32 @@
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(TextEx),true),CanEditMultipleObjects]
public class TextExEditor:UnityEditor.UI.TextEditor {
[CustomEditor(typeof(TextEx), true), CanEditMultipleObjects]
public class TextExEditor : UnityEditor.UI.TextEditor
{
    private SerializedProperty m_IsKey;
    private SerializedProperty m_KeyName;
    private SerializedProperty m_ColorType;
    private SerializedProperty m_TextBackgroundType;
    public override void OnInspectorGUI() {
        base.OnInspectorGUI();
        EditorGUILayout.Space();
        TextEx text = target as TextEx;
        text.isKey = EditorGUILayout.Toggle("是语言表ID",text.isKey);
        text.keyName = EditorGUILayout.TextField(text.keyName, GUILayout.Width(200));
        text.colorType = (TextColType)EditorGUILayout.EnumPopup("颜色类型", text.colorType);
        text.bgColorType = (TextEx.BackGroundColorType)EditorGUILayout.EnumPopup("背景颜色类型", text.bgColorType);
    protected override void OnEnable()
    {
        base.OnEnable();
        m_IsKey = serializedObject.FindProperty("m_IsKey");
        m_KeyName = serializedObject.FindProperty("m_KeyName");
        m_ColorType = serializedObject.FindProperty("m_ColorType");
        m_TextBackgroundType = serializedObject.FindProperty("m_TextBackgroundType");
    }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        serializedObject.Update();
        EditorGUILayout.Space();
        EditorGUILayout.PropertyField(m_IsKey, new GUIContent("是语言表ID"));
        EditorGUILayout.PropertyField(m_KeyName, new GUIContent("语言表key"));
        EditorGUILayout.PropertyField(m_ColorType, new GUIContent("颜色类型"));
        EditorGUILayout.PropertyField(m_TextBackgroundType, new GUIContent("背景底图类型"));
        serializedObject.ApplyModifiedProperties();
    }
}