| Assets/Editor/UIComponent/GradientTextEditor.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Assets/Editor/UIComponent/RichTextEditor.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Assets/Editor/UIComponent/TextExEditor.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Assets/Editor/UIComponent/GradientTextEditor.cs
@@ -5,6 +5,7 @@ [CustomEditor(typeof(GradientText), true), CanEditMultipleObjects] public class GradientTextEditor : UnityEditor.UI.TextEditor { private SerializedProperty m_TextBackgroundType; private SerializedProperty m_GradientType; private SerializedProperty m_TopLeftColor; private SerializedProperty m_TopRightColor; @@ -17,6 +18,7 @@ { base.OnEnable(); m_TextBackgroundType = serializedObject.FindProperty("m_TextBackgroundType"); m_GradientType = serializedObject.FindProperty("m_GradientType"); m_TopLeftColor = serializedObject.FindProperty("m_TopLeftColor"); m_TopRightColor = serializedObject.FindProperty("m_TopRightColor"); @@ -46,6 +48,7 @@ serializedObject.Update(); EditorGUILayout.PropertyField(m_TextBackgroundType, new GUIContent("背景底图类型")); EditorGUILayout.PropertyField(m_UseGradient, new GUIContent("启用渐变")); if (m_UseGradient.boolValue) Assets/Editor/UIComponent/RichTextEditor.cs
@@ -6,9 +6,11 @@ [CanEditMultipleObjects] public class RichTextEditor : UnityEditor.UI.TextEditor { private RichText m_Target; private SerializedProperty m_TextBackgroundType; protected override void OnEnable() { base.OnEnable(); m_TextBackgroundType = serializedObject.FindProperty("m_TextBackgroundType"); if (target != null) { m_Target = target as RichText; } @@ -62,7 +64,9 @@ EditorGUILayout.EndHorizontal(); } EditorGUILayout.BeginHorizontal(); m_Target.colorType = (RichText.ColorType)EditorGUILayout.EnumPopup("Color Type", m_Target.colorType); serializedObject.Update(); EditorGUILayout.PropertyField(m_TextBackgroundType, new GUIContent("背景底图类型")); serializedObject.ApplyModifiedProperties(); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("ResetSize")) { 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(); } }