fix
This commit is contained in:
parent
ca28bb2c55
commit
c9740c3fb6
@ -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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 覆盖基类的 ApplyVisualState:先由基类处理 MainTransition,再处理 child transitions(保持原逻辑)
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user