protected void InvokeButtonReleased(EControllerID controllerID, EInputButton inputButton) { if (ButtonReleased != null) { ButtonReleased.Invoke(controllerID, inputButton); } }
private void OnKeyRelease(KeyInfo info) { if (keyMappings.ContainsKey(info.KeyCode) && ButtonReleased != null) { ButtonReleased.Invoke(keyMappings[info.KeyCode]); } }
private void OnButtonRelease(int buttonId) { ButtonReleased?.Invoke(this, new ButtonPressedEventArgs() { ButtonId = buttonId, Device = null }); }
public void ResetSwitch() { if (!isSwitch || pressedCount > 0) { return; } ButtonReleased.Invoke(); }
private void OnTriggerExit2D(Collider2D other) { if (--pressedCount != 0 || isSwitch) { return; } ButtonReleased.Invoke(); anim.SetBool("pressed", false); }
private void _buttonPin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args) { if (args.Edge == GpioPinEdge.FallingEdge) { ButtonPressed?.Invoke(this, DateTime.Now); } else { ButtonReleased?.Invoke(this, DateTime.Now); } }
private void InDevOnNoteOn(NoteOnMessage msg) { if (msg.Velocity == 0) { ButtonReleased?.Invoke(new ButtonReleasedEventArgs(PitchToButton(msg.Pitch))); } else { ButtonPressed?.Invoke(new ButtonPressedEventArgs(PitchToButton(msg.Pitch))); } }
private void Pin_ValueChanged(object sender, GpioPinValueChangedEventArgs e) { if (e.Edge == GpioPinEdge.RisingEdge) { ButtonPressed?.Invoke(); } else { ButtonReleased?.Invoke(); } }
protected virtual void OnKeyReleased(KeyCode key) { if (m_keyToControllerInput.TryGetValue(key, out ControllerInput input)) { var list = m_buttons[input]; bool wasDown = list.Count > 0; list.Remove(key); if (wasDown && list.Count == 0) { ButtonReleased?.Invoke(input); } } }
private void OnButtonReleased(uint index) { if (m_buttonToControllerInput.TryGetValue((int)index, out ControllerInput input)) { var list = m_buttons[input]; bool wasDown = list.Count > 0; list.Remove(index); if (wasDown && list.Count == 0) { ButtonReleased?.Invoke(input); } } }
internal void HandleInputEvent(uint buttonIndex, uint newState) { var info = new ButtonInfo() { DeviceIndex = DeviceIndex, Button = buttonIndex, }; buttonStates[buttonIndex] = newState; if (newState == 1) { ButtonPressed?.Invoke(buttonIndex); Host.ButtonPressed(info); } else { ButtonReleased?.Invoke(buttonIndex); Host.ButtonReleased(info); } }
/// <summary> /// Event listner for timer in controller /// </summary> /// <param name="sender">Event invoker</param> /// <param name="e">Event arguments</param> internal void TimerOnElapsed(object sender, ElapsedEventArgs e) { if (IsButtonPressed && !lastButtonState_) { buttonTimer_.Reset(); buttonTimer_.Start(); ButtonPressed?.Invoke(this, EventArgs.Empty); } else if (!IsButtonPressed && lastButtonState_) { buttonTimer_.Stop(); ButtonReleased?.Invoke(this, new ButtonReleasedEventArgs(buttonTimer_.Elapsed.TotalMilliseconds < parent_.HoldMinTime ? ButtonState.Clicked : ButtonState.Holded)); } lastButtonState_ = IsButtonPressed; }
public CallButtonService(ILogger <CallButtonService> logger, HubConnection hubConnection) { _logger = logger; _hubConnection = hubConnection; _hubConnection.Closed += async(exception) => { if (exception != null) { _logger.LogError(exception, "Connection unexpectedly."); await Task.Delay(new Random().Next(0, 5) * 1000).ConfigureAwait(false); try { await _hubConnection.StartAsync().ConfigureAwait(false); _logger.LogInformation("Connection restarted."); } catch (Exception exc) { _logger.LogError(exc, "Failed to restart connection."); } } }; pressedSubscription = _hubConnection.On <string>("ButtonPressed", _ => { ButtonPressed?.Invoke(this, EventArgs.Empty); }); releasedSubscription = _hubConnection.On <string>("ButtonReleased", _ => { ButtonReleased?.Invoke(this, EventArgs.Empty); }); }
/// <summary> /// Raises the <see cref="ButtonReleased"/> event. /// </summary> /// <param name="window">The window in which the input event took place.</param> /// <param name="button">The mouse button that was released.</param> protected virtual void OnButtonReleased(IUltravioletWindow window, MouseButton button) => ButtonReleased?.Invoke(window, this, button);
private void OnButtonReleased(Buttons button) { ButtonReleased?.Invoke(this, new GamepadButtonEventArgs(button)); }
/// <summary> /// Raises the <see cref="ButtonReleased"/> event. /// </summary> /// <param name="window">The window that raised the event.</param> /// <param name="scancode">The <see cref="Scancode"/> that represents the button that was released.</param> protected virtual void OnButtonReleased(IUltravioletWindow window, Scancode scancode) => ButtonReleased?.Invoke(window, this, scancode);
/// <summary> /// Raises the <see cref="ButtonReleased"/> event. /// </summary> /// <param name="button">The <see cref="GamePadButton"/> value that represents the button that was pressed.</param> protected virtual void OnButtonReleased(GamePadButton button) => ButtonReleased?.Invoke(this, button);
protected virtual void OnButtonReleased(JoystickEventArgs e) { ButtonReleased?.Invoke(this, e); }