This commit is contained in:
陈思海 2025-08-05 11:12:42 +08:00
parent b22e44a0e3
commit 3e557e4235

View File

@ -62,7 +62,6 @@ public class UXButton : UIBehaviour, IButton,
private Animator _animator; private Animator _animator;
private WaitForSeconds _waitTimeFadeDuration; private WaitForSeconds _waitTimeFadeDuration;
private Coroutine _resetRoutine; private Coroutine _resetRoutine;
private bool _boardEvent;
private readonly Dictionary<string, int> _animTriggerIDs = new(); private readonly Dictionary<string, int> _animTriggerIDs = new();
private readonly Dictionary<string, int> _animResetTriggerIDs = new(); private readonly Dictionary<string, int> _animResetTriggerIDs = new();
@ -132,7 +131,6 @@ public class UXButton : UIBehaviour, IButton,
protected void Initlize() protected void Initlize()
{ {
_boardEvent = true;
_waitTimeFadeDuration = new WaitForSeconds( _waitTimeFadeDuration = new WaitForSeconds(
Mathf.Max(0.01f, m_TransitionData.colors.fadeDuration)); Mathf.Max(0.01f, m_TransitionData.colors.fadeDuration));
_animTriggerIDs.Clear(); _animTriggerIDs.Clear();
@ -239,11 +237,16 @@ public class UXButton : UIBehaviour, IButton,
#region Public Methods #region Public Methods
public void SetSelect(bool state, bool boardEvent = false) public bool Selected
{ {
if (m_Mode != ButtonModeType.Toggle) return; get => IsSelected;
_boardEvent = boardEvent; set
IsSelected = state; {
if (m_Mode == ButtonModeType.Toggle)
{
ProcessClick();
}
}
} }
#endregion #endregion
@ -259,13 +262,6 @@ public class UXButton : UIBehaviour, IButton,
private void ProcessClick() private void ProcessClick()
{ {
if (!_boardEvent)
{
_boardEvent = true;
return;
}
_boardEvent = true;
if (m_Mode == ButtonModeType.Normal) if (m_Mode == ButtonModeType.Normal)
{ {
UISystemProfilerApi.AddMarker("Button.onClick", this); UISystemProfilerApi.AddMarker("Button.onClick", this);