public void onTouchPressed(TouchLocation touch) { if (this.IsClickOnSelf(touch.Position.ToPoint())) { if (this.ShouldVibrateOnClick) { VibrationHelper.Vibrate(); } if (this.ShouldPlaySoundOnClick) { ContentHolder.Get(AvailableSounds.click).TryPlay(); } this.OnClick?.Invoke(); this.LastClickWasOnSelf = true; this.LastClickTouchID = touch.Id; } else { this.LastClickWasOnSelf = false; } }
public override void onMouseDown(MouseEventArgs e) { base.onMouseDown(e); if (e.Button == MouseButtons.LeftButton) { if (this.IsClickOnSelf(e.Position)) { if (this.ShouldVibrateOnClick) { VibrationHelper.Vibrate(); } if (this.ShouldPlaySoundOnClick) { ContentHolder.Get(AvailableSounds.click).TryPlay(); } this.OnClick?.Invoke(); this.LastClickWasOnSelf = true; } else { this.LastClickWasOnSelf = false; } } }