private void Update() { foreach (var command in _toRemove) { _commands.Remove(command); _isPressed.Remove(command); _wasPressed.Remove(command); } _toRemove.Clear(); foreach (var command in _commands) { if (_toRemove.Contains(command)) { continue; } var blockFlag = command.GetValue <bool>("_blockNextRelease"); if (command.IsNewlyPressed()) { OnNewlyPressed?.Invoke(command); } if (command.IsNewlyHeld(MinimalPressDuration)) { OnNewlyHeld?.Invoke(command); } if (command.IsPressed()) { OnPressed?.Invoke(command); _isPressed[command] = true; } else { _wasPressed[command] = _isPressed[command]; _isPressed[command] = false; } if (command.IsNewlyReleased()) { OnNewlyReleased?.Invoke(command); } if (command.IsHeld(MinimalPressDuration)) { OnHeld?.Invoke(command); } if (command.IsTapped(MaximalTapDuration)) { OnTapped?.Invoke(command); } if (blockFlag)//damn you, Mobius Digital { var toReblock = _wasPressed[command] || _isPressed[command]; command.SetValue("_blockNextRelease", toReblock); } } }
public TapGestureRecognizer getTapGestureRecognizer() { TapGestureRecognizer tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.NumberOfTapsRequired = 1; tapGestureRecognizer.Tapped += (s, e) => { GridEventArgs args = new GridEventArgs(); args.position = postion; args.view = (View)s; OnTapped?.Invoke(grid, args); }; return(tapGestureRecognizer); }
private void OnpanelTapped() { DOTween.Sequence() .Append(transform.DOScale(0.9f, 0.1f)) .Append(transform.DOScale(1, 0.05f)); if (level.IsEnabled) { AudioManager.Instance.PlaySound(SoundType.OpenLevel); OnTapped?.Invoke(level); } else { AudioManager.Instance.PlaySound(SoundType.EmptyClick); } }
/// @param eventData /// The data of the touch event /// public void OnPointerUp(PointerEventData eventData) { OnTouchedUp.SafeInvoke(eventData.position); if (m_upEvent != null) { m_upEvent.Invoke(); } if (m_touched == true) { OnTapped.SafeInvoke(eventData.position); if (m_tapEvent != null) { m_tapEvent.Invoke(eventData.position); } } m_touched = false; }
public void Update(float deltaTime) { if (Input.GetMouseButtonDown(0)) { StartHold(); OnTapped?.Invoke(); } if (Input.GetMouseButton(0)) { Holding(deltaTime); } if (Input.GetMouseButtonUp(0)) { FinishHold(); } }
public void OnTextTapped(object sender, EventArgs e) { OnTapped?.Invoke(this); }
private void Tap_Tapped(object sender, EventArgs e) { OnTapped?.Invoke(this, EventArgs.Empty); }
private void TapGestureRecognizer_Tapped(object sender, EventArgs e) { OnTapped.Invoke(sender, e); }
private void OnMouseUpAsButton() { OnTapped?.Invoke(this); }