This commit is contained in:
陈思海 2025-12-15 13:42:08 +08:00
parent 777cc90eaa
commit 8a6e84cc71
3 changed files with 13 additions and 4 deletions

View File

@ -27,7 +27,6 @@ internal class UXButtonEditor : UXSelectableEditor
private SerializedProperty m_UXGroup;
private SerializedProperty m_ChildTransitions;
private ReorderableList m_ChildTransitionList;
private static Color darkZebraEven = new Color(0.22f, 0.22f, 0.22f);

View File

@ -23,6 +23,7 @@ namespace UnityEngine.UI
protected SerializedProperty m_Navigation;
protected SerializedProperty m_MainTransition;
protected SerializedProperty m_Interactable;
protected SerializedProperty m_animator;
// 抽象皮肤(现在放在基类)
protected GUISkin customSkin;
@ -53,6 +54,7 @@ namespace UnityEngine.UI
m_Navigation = serializedObject.FindProperty("m_Navigation");
m_MainTransition = serializedObject.FindProperty("m_MainTransition");
m_Interactable = serializedObject.FindProperty("m_Interactable");
m_animator = serializedObject.FindProperty("_animator");
// load customSkin once in base; 调整路径为你项目中 GUISkin 的实际路径(必要时修改)
customSkin = AssetDatabase.LoadAssetAtPath<GUISkin>("Packages/com.alicizax.unity.ui.extension/Editor/Res/GUISkin/UIExtensionGUISkin.guiskin");
@ -322,7 +324,16 @@ namespace UnityEngine.UI
EditorGUILayout.PropertyField(transition);
var animator = graphic != null ? graphic.GetComponent<Animator>() : (target as UXSelectable).GetComponent<Animator>();
Animator animator = null;
if (target is UXSelectable anima)
{
animator = anima.GetComponent<Animator>();
}
else if (m_animator.objectReferenceValue != null)
{
animator = (Animator)m_animator.objectReferenceValue;
}
switch (currentTransition)
{
case Selectable.Transition.ColorTint:

View File

@ -57,8 +57,7 @@ namespace UnityEngine.UI
protected static int s_SelectableCount = 0;
protected int m_CurrentIndex = -1;
protected bool m_EnableCalled = false;
private Animator _animator;
[SerializeField] private Animator _animator;
public Animator Animator => _animator ? _animator : _animator = GetComponent<Animator>();
public static readonly Dictionary<string, int> _animTriggerCache = new()