@@ -14,7 +14,6 @@ public abstract class CustomButtonBase : MonoBehaviour, ICustomButton
1414 public RectTransform rectTransform ;
1515
1616 [ SerializeField ] private bool _interactable = true ;
17- [ SerializeField ] private PointerFilter _pointerFilter = PointerFilter . LeftClick | PointerFilter . Tap ;
1817
1918 public bool Interactable
2019 {
@@ -28,16 +27,6 @@ public bool Interactable
2827 }
2928 }
3029
31- public PointerFilter PointerFilter
32- {
33- get => _pointerFilter ;
34- set
35- {
36- _pointerFilter = value ;
37- UpdatePointerFilter ( ) ;
38- }
39- }
40-
4130 public Graphic targetGraphic
4231 {
4332 get => Transition . targetGraphic ;
@@ -94,7 +83,6 @@ private void Awake()
9483 private void OnEnable ( )
9584 {
9685 onClick . AddListener ( OnClick ) ;
97- UpdatePointerFilter ( ) ;
9886 }
9987
10088 private void OnDisable ( )
@@ -111,33 +99,8 @@ private void Reset()
11199 Transition = new ( ) { targetGraphic = GetComponent < Graphic > ( ) } ;
112100 }
113101
114- private void OnValidate ( )
115- {
116- UpdatePointerFilter ( ) ;
117- }
118-
119102 #endregion
120103
121- private void UpdatePointerFilter ( )
122- {
123- if ( ! Application . isPlaying ) return ;
124- filter = new ( ) ;
125- int value = ( int ) _pointerFilter ;
126- int comparingValue = 1 ;
127- for ( int i = 0 ; i < 32 ; i ++ )
128- {
129- if ( ( comparingValue & value ) != 0 )
130- filter . Add ( i - 3 ) ;
131-
132- comparingValue <<= 1 ;
133- }
134-
135- for ( int i = 0 ; i < filter . Count ; i ++ )
136- {
137- Debug . Log ( filter [ i ] ) ;
138- }
139- }
140-
141104 public void ToogleInteractable ( ) => Interactable = ! Interactable ;
142105
143106 public virtual void OnClick ( )
@@ -163,7 +126,7 @@ public void OnSubmit(BaseEventData eventData)
163126 //Goes after PointerUp
164127 public void OnPointerClick ( PointerEventData eventData )
165128 {
166- if ( ! _interactable || ! filter . Contains ( eventData . pointerId ) ) return ;
129+ if ( ! _interactable || eventData . button != PointerEventData . InputButton . Left ) return ;
167130 selectionState = SelectionState . Selected ;
168131 isSelected = true ;
169132 EventSystem . current . SetSelectedGameObject ( gameObject ) ;
@@ -172,14 +135,13 @@ public void OnPointerClick(PointerEventData eventData)
172135
173136 public void OnPointerDown ( PointerEventData eventData )
174137 {
175- if ( ! _interactable || ! filter . Contains ( eventData . pointerId ) ) return ;
138+ if ( ! _interactable || eventData . button != PointerEventData . InputButton . Left ) return ;
176139 selectionState = SelectionState . Pressed ;
177140 }
178141
179- //Goes before PointerUp
180142 public void OnPointerUp ( PointerEventData eventData )
181143 {
182- if ( ! _interactable || ! filter . Contains ( eventData . pointerId ) ) return ;
144+ if ( ! _interactable || eventData . button != PointerEventData . InputButton . Left ) return ;
183145 pointerUpBuffer = StartCoroutine ( PointerUpBuffer ( ) ) ;
184146 }
185147
0 commit comments