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