editor部分脚本设为私有,避免污染补全上下文。

添加按钮的重写结构
This commit is contained in:
2026-04-21 14:28:37 +08:00
parent eb7bdfccc3
commit 2c5bee8677
12 changed files with 291 additions and 8 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ using Object = UnityEngine.Object;
namespace XericUIEditor.Core.Vessel
{
[CustomPropertyDrawer(typeof(ObjectVessel<,>))]
public class ObjectVessel2Property : ObjectVesselPropertyBase
internal class ObjectVessel2Property : ObjectVesselPropertyBase
{
private Type property0Type = typeof(Object);
private Type property1Type = typeof(Object);
+1 -1
View File
@@ -8,7 +8,7 @@ using Object = UnityEngine.Object;
namespace XericUIEditor.Core.Vessel
{
[CustomPropertyDrawer(typeof(ObjectVessel<,,>))]
public class ObjectVessel3Property : ObjectVesselPropertyBase
internal class ObjectVessel3Property : ObjectVesselPropertyBase
{
private Type property0Type = typeof(Object);
private Type property1Type = typeof(Object);
+1 -1
View File
@@ -7,7 +7,7 @@ using Object = UnityEngine.Object;
namespace XericUIEditor.Core.Vessel
{
[CustomPropertyDrawer(typeof(ObjectVessel<>))]
public class ObjectVesselProperty : ObjectVesselPropertyBase
internal class ObjectVesselProperty : ObjectVesselPropertyBase
{
private Type property0Type = typeof(Object);
private string originTooltip = null;
@@ -5,7 +5,7 @@ using XericUI.Core.Vessel;
namespace XericUIEditor.Core.Vessel
{
public class ObjectVesselPropertyBase : PropertyDrawer
internal class ObjectVesselPropertyBase : PropertyDrawer
{
/// <summary>
/// 递归获取实际的泛型类型(处理嵌套情况)
@@ -7,7 +7,7 @@ namespace XericUIEditor.OverrideLayout
{
[CustomEditor(typeof(XericHorizontalOrVerticalLayoutGroup), true)]
[CanEditMultipleObjects]
public class XericHorizontalOrVerticalLayoutGroupEditor : HorizontalOrVerticalLayoutGroupEditor
internal class XericHorizontalOrVerticalLayoutGroupEditor : HorizontalOrVerticalLayoutGroupEditor
{
SerializedProperty ignoreInvisible;
SerializedProperty enableListScreening;
@@ -7,7 +7,7 @@ namespace XericUIEditor.OverrideLayout
{
[CustomEditor(typeof(XericScrollRect), true)]
[CanEditMultipleObjects]
public class XericScrollRectEditor : ScrollRectEditor
internal class XericScrollRectEditor : ScrollRectEditor
{
SerializedProperty m_EnableAutoActiveByMaskVisible;
SerializedProperty m_layoutGroup;
+62
View File
@@ -0,0 +1,62 @@
using UnityEditor;
using UnityEditor.UI;
using XericUI.OverrideUI;
namespace XericUIEditor.OverrideUI
{
[CustomEditor(typeof(XericButton), true)]
[CanEditMultipleObjects]
/// <summary>
/// Custom Editor for the Button Component.
/// Extend this class to write a custom editor for a component derived from Button.
/// </summary>
internal class XericButtonEditor : SelectableEditor
{
SerializedProperty m_OnClickProperty;
SerializedProperty m_TextProperty;
SerializedProperty m_EnableTextColorTransitionProperty;
SerializedProperty m_TextTransitionColorModeProperty;
SerializedProperty m_enableTextContextTransitionProperty;
SerializedProperty m_textTransitionContextModeProperty;
protected override void OnEnable()
{
base.OnEnable();
m_OnClickProperty = serializedObject.FindProperty("m_OnClick");
m_TextProperty = serializedObject.FindProperty("m_text");
m_EnableTextColorTransitionProperty = serializedObject.FindProperty("m_enableTextColorTransition");
m_TextTransitionColorModeProperty = serializedObject.FindProperty("m_textTransitionColorMode");
m_enableTextContextTransitionProperty = serializedObject.FindProperty("m_enableTextContextTransition");
m_textTransitionContextModeProperty = serializedObject.FindProperty("m_textTransitionContextMode");
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
EditorGUILayout.Space();
serializedObject.Update();
EditorGUILayout.PropertyField(m_TextProperty);
EditorGUILayout.PropertyField(m_EnableTextColorTransitionProperty);
if (m_EnableTextColorTransitionProperty.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_TextTransitionColorModeProperty);
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(m_enableTextContextTransitionProperty);
if (m_enableTextContextTransitionProperty.boolValue)
{
EditorGUI.indentLevel++;
EditorGUILayout.PropertyField(m_textTransitionContextModeProperty);
EditorGUI.indentLevel--;
}
EditorGUILayout.PropertyField(m_OnClickProperty);
serializedObject.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 00e32f6988bf41f29169c1660bcf009f
timeCreated: 1776646534
+3 -1
View File
@@ -3,8 +3,9 @@ using UnityEditor.SceneManagement;
using UnityEditor.UI;
using UnityEngine;
using UnityEngine.UI;
using XericUI;
namespace XericUI
namespace XericUIEditor.OverrideUI
{
[CustomEditor(typeof(XericToggle))]
internal class XericToggleEditor : SelectableEditor
@@ -68,6 +69,7 @@ namespace XericUI
EditorGUILayout.PropertyField(m_TransitionProperty);
EditorGUILayout.PropertyField(m_GraphicProperty);
EditorGUILayout.PropertyField(m_TextProperty);
EditorGUILayout.PropertyField(m_EnableTextColorTransitionProperty);
if (m_EnableTextColorTransitionProperty.boolValue)