From c9740c3fb67e257075152c017bcb8fbd111c9ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Wed, 17 Dec 2025 17:15:24 +0800 Subject: [PATCH] fix --- Runtime/UXComponent/Button/UXButton.cs | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/Runtime/UXComponent/Button/UXButton.cs b/Runtime/UXComponent/Button/UXButton.cs index 0e1eb97..ad1c468 100644 --- a/Runtime/UXComponent/Button/UXButton.cs +++ b/Runtime/UXComponent/Button/UXButton.cs @@ -144,8 +144,6 @@ public class UXButton : UXSelectable, IButton, IPointerClickHandler, ISubmitHand if (old._mTogSelected && old.m_Mode == ButtonModeType.Toggle) old.SetState(SelectionState.Selected); - else - old.SetState(SelectionState.Normal); } if (newLocked != null) @@ -343,10 +341,6 @@ public class UXButton : UXSelectable, IButton, IPointerClickHandler, ISubmitHand m_IsNavFocused = true; - // 变更:当通过 EventSystem.current.SetSelectedGameObject(...) 选中时, - // 也要像 Focus() 一样将静态锁设置到当前按钮(除非已经是自己)。 - // 这样外部直接调用 EventSystem.current.SetSelectedGameObject(...) 就能生效, - // 无需再调用 Focus(). if (s_LockedButton != this) { SetLockedButton(this); @@ -381,10 +375,8 @@ public class UXButton : UXSelectable, IButton, IPointerClickHandler, ISubmitHand if (selectionIsNull) { - // 统一走封装入口清理锁 - SetLockedButton(null); - - // 额外保证本实例的本地标志被清掉(以防极端顺序仍然残留) + m_IsNavFocused = false; + s_LockedButton = null; m_IsFocusLocked = false; } @@ -543,15 +535,9 @@ public class UXButton : UXSelectable, IButton, IPointerClickHandler, ISubmitHand ApplyVisualState(state, true); } - /// - /// 覆盖基类的 ApplyVisualState:先由基类处理 MainTransition,再处理 child transitions(保持原逻辑) - /// public override void ApplyVisualState(SelectionState state, bool instant) { - // main transition 由基类处理 base.ApplyVisualState(state, instant); - - // child transitions 保持原有处理(UXButton 特有) for (int i = 0; i < m_ChildTransitions.Count; i++) base.ApplyTransition(m_ChildTransitions[i], state, instant); }