Ejemplo n.º 1
0
 private void Pin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
 {
     if (args.Edge == GpioPinEdge.FallingEdge)
     {
         ButtonPressed?.Invoke(sender, args);
     }
 }
 public void Button_TouchUpInside(object sender, EventArgs e)
 {
     if (ButtonPressed != null)
     {
         ButtonPressed.Invoke();
     }
 }
Ejemplo n.º 3
0
 protected override void OnClick(object sender, MouseEventArgs e)
 {
     base.OnClick(this, e);
     ButtonPressed?.Invoke(new ButtonPressedEventArgs {
         Message = TEXT
     });
 }
Ejemplo n.º 4
0
        private void mInputDevice_NoteOn(NoteOnMessage msg)
        {
            LaunchpadButton button = GetButton(msg.Pitch);

            if (button == null)
            {
                return;
            }
            button.State = (ButtonPressState)msg.Velocity;
            if (ButtonPressed == null)
            {
                return;
            }


            var pressEventArgs = (int)msg.Pitch % 16 == 8 ? new ButtonPressEventArgs((SideButton)((int)msg.Pitch / 16), button) : new ButtonPressEventArgs((int)msg.Pitch % 16, (int)msg.Pitch / 16, button);

            if (button.State == ButtonPressState.Up)
            {
                ButtonPressed?.Invoke(this, pressEventArgs);
                ButtonUp?.Invoke(this, pressEventArgs);
            }
            else
            {
                ButtonDown?.Invoke(this, pressEventArgs);
            }
        }
Ejemplo n.º 5
0
 //private void OnCollisionEnter(Collision collision)
 //{
 //    if (collision.gameObject.tag == "Button")
 //    {
 //        ButtonPressed?.Invoke();
 //    }
 //}
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Button"))
     {
         ButtonPressed?.Invoke();
     }
 }
Ejemplo n.º 6
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (ButtonPressed != null)
     {
         ButtonPressed.Invoke(this, EventArgs.Empty);
     }
 }
Ejemplo n.º 7
0
        private void UpdateTimer(Keys key, Buttons button, float directionX, float directionY, float elapsedTime, ButtonDown downAction, ButtonUp upAction, ButtonPressed pressAction, ref float downTimer, ref float upTimer)
        {
            if (IsKeyDown(key) || currentGamePadState.IsButtonDown(button))
            {
                if (downAction != null && downTimer == 0)
                {
                    downAction.Invoke(directionX, directionY, upTimer, PlayerIndex);
                }

                downTimer += elapsedTime;
                upTimer    = 0;
            }
            else if (IsKeyUp(key) || currentGamePadState.IsButtonUp(button))
            {
                //Check if it was a press of key
                if (this.oldKeyboardState.IsKeyDown(key) || oldGamePadState.IsButtonDown(button))
                {
                    if (pressAction != null)
                    {
                        pressAction.Invoke(PlayerIndex);
                    }

                    if (upAction != null)
                    {
                        upAction.Invoke(downTimer, PlayerIndex);
                    }
                }
                upTimer  += elapsedTime;
                downTimer = 0;
            }
        }
Ejemplo n.º 8
0
 public void OnMouseLeftPressed(float x, float y)
 {
     if (Contains(x, y))
     {
         ButtonPressed?.Invoke();
     }
 }
Ejemplo n.º 9
0
 protected virtual void OnButtonPressed(MenuActionEventArgs e, Menu sender)
 {
     if (e.PressedKey == Keys.Space || e.PressedKey == Keys.Enter)
     {
         ButtonPressed?.Invoke(sender, e);
     }
 }
Ejemplo n.º 10
0
        public Dialogue(string title, string contents, string[] buttons)
        {
            Title    = title;
            Contents = contents;
            Buttons  = buttons;

            Focused += (_, ev) => ev.Cancel = false;

            KeyPressed += (_, ev) =>
            {
                ev.Rerender = true;

                switch (ev.Key.Key)
                {
                case ConsoleKey.LeftArrow:
                    _highlightIndex = (_highlightIndex - 1).Mod(Buttons.Length);
                    break;

                case ConsoleKey.Tab:
                case ConsoleKey.RightArrow:
                    _highlightIndex = (_highlightIndex + 1).Mod(Buttons.Length);
                    break;

                case ConsoleKey.Enter:
                    ButtonPressed?.Invoke(this, Buttons[_highlightIndex]);
                    break;

                default:
                    ev.Rerender = false;
                    break;
                }
            };
        }
Ejemplo n.º 11
0
 private void OnButtonPress(int buttonId)
 {
     ButtonPressed?.Invoke(this, new ButtonPressedEventArgs()
     {
         ButtonId = buttonId, Device = null
     });
 }
Ejemplo n.º 12
0
 protected void InvokeButtonPressed(EControllerID controllerID, EInputButton inputButton)
 {
     if (ButtonPressed != null)
     {
         ButtonPressed.Invoke(controllerID, inputButton);
     }
 }
Ejemplo n.º 13
0
        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            if (!isBeingModified)
            {
                EventArgs e = new EventArgs();
                base.TouchesBegan(touches, evt);
                UITouch touch = touches.AnyObject as UITouch;

                CGPoint p = touch.LocationInView(touch.View);
                for (int i = 0; i < curveArray.Length; i++)
                {
                    if (viewArray[i].Frame.Contains(touch.LocationInView(View)))
                    {
                        if (stopwatch.ElapsedMilliseconds > 200)
                        {
                            curveArray[currentSelection].InvertColors = false;
                            currentSelection = i;
                            curveArray[currentSelection].InvertColors = true;
                            ButtonHeld?.Invoke(this, e);

                            //ButtonPressed?.Invoke(this, e);
                        }
                        else
                        {
                            // the touch event happened inside the UIView
                            curveArray[currentSelection].InvertColors = false;
                            currentSelection = i;
                            curveArray[currentSelection].InvertColors = true;
                            ButtonPressed?.Invoke(this, e);
                        }
                    }
                }
            }
        }
Ejemplo n.º 14
0
 private void OnButtonPress(object sender, ButtonPressedEventArgs e)
 {
     ButtonPressed?.Invoke(this, new ButtonPressedEventArgs()
     {
         ButtonId = e.ButtonId, Device = this
     });
 }
Ejemplo n.º 15
0
 private void OnKeyPress(KeyInfo info)
 {
     if (keyMappings.ContainsKey(info.KeyCode) && ButtonPressed != null)
     {
         ButtonPressed.Invoke(keyMappings[info.KeyCode]);
     }
 }
Ejemplo n.º 16
0
 private void InvokePlayerInputPressed(string inputPressed, PlayerData playerData)
 {
     print("PlayerInputPressed: " + playerData.InputDeviceSlot);
     if (ButtonPressed != null)
     {
         ButtonPressed.Invoke(inputPressed, playerData);
     }
 }
Ejemplo n.º 17
0
 private void Mouse_LeftClicked(object sender, EventArgs e)
 {
     if (shape.GetGlobalBounds().Intersects(Game.Input.Mouse.Position))
     {
         Game.AudioPlayer.PlaySound("GUI_CLICK");
         ButtonPressed?.Invoke(this, null);
     }
 }
Ejemplo n.º 18
0
        private async System.Threading.Tasks.Task AnimatePressButtonAsync()
        {
            Down();
            ButtonPressed?.Invoke(this, EventArgs.Empty);
            await Task.Delay(500);

            Up();
        }
Ejemplo n.º 19
0
        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            tintLayer.RemoveFromSuperLayer();

            ButtonPressed?.Invoke(this, new EventArgs());
        }
Ejemplo n.º 20
0
        /// <summary>
        /// Raises the button pressed event.
        /// </summary>
        /// <param name="button">The button.</param>
        protected virtual void OnButtonPressed(LogitechF710Button button)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException(nameof(LogitechF710));
            }

            ButtonPressed?.Invoke(this, new LogitechF710ButtonEventArgs(button));
        }
Ejemplo n.º 21
0
        private void Button_Clicked(object sender, EventArgs e)
        {
            var s = (sender as Button)?.Text;

            if (s != null)
            {
                ButtonPressed?.Invoke(s);
            }
        }
                private void OnClick()
                {
                    ButtonPressed?.Invoke(SortMode);

                    if (SortMode == SongSortModule.CurrentSortMode)
                    {
                        ButtonColour = SongSortModule.Reversed ? SortModeTab.SelectedReversedColour : SortModeTab.SelectedColour;
                    }
                }
Ejemplo n.º 23
0
        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            tintLayer.RemoveFromSuperLayer();

            IsShown = !IsShown;

            ButtonPressed?.Invoke(this, default(EventArgs));
        }
Ejemplo n.º 24
0
        void GamepadHook_ButtonPressed(object sender, GamepadButton e)
        {
            AnyGamepadButtonPressed?.Invoke(this, e);

            if (RegisteredButtons.Contains(e))
            {
                ButtonPressed?.Invoke(this, e);
                KeyOrButtonPressed?.Invoke(this, new KeyOrButton(e));
            }
        }
Ejemplo n.º 25
0
        private UIGestureRecognizer GetTapGestureRecognizer(bool skipped)
        {
            var tapGesture = new UITapGestureRecognizer(() => { ButtonPressed?.Invoke(skipped); })
            {
                NumberOfTapsRequired    = 1,
                NumberOfTouchesRequired = 1
            };

            return(tapGesture);
        }
Ejemplo n.º 26
0
 private void InDevOnNoteOn(NoteOnMessage msg)
 {
     if (msg.Velocity == 0)
     {
         ButtonReleased?.Invoke(new ButtonReleasedEventArgs(PitchToButton(msg.Pitch)));
     }
     else
     {
         ButtonPressed?.Invoke(new ButtonPressedEventArgs(PitchToButton(msg.Pitch)));
     }
 }
Ejemplo n.º 27
0
 private void _buttonPin_ValueChanged(GpioPin sender, GpioPinValueChangedEventArgs args)
 {
     if (args.Edge == GpioPinEdge.FallingEdge)
     {
         ButtonPressed?.Invoke(this, DateTime.Now);
     }
     else
     {
         ButtonReleased?.Invoke(this, DateTime.Now);
     }
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Notify everyone who cares that the button has been pressed.
 /// </summary>
 /// <param name="agentInteracting"></param>
 public void Interact(GameObject agentInteracting)
 {
     if (canInteract)
     {
         // Notify anyone who cares that the button was pressed.
         if (ButtonPressed != null)
         {
             ButtonPressed.Invoke();
         }
     }
 }
Ejemplo n.º 29
0
 private void Pin_ValueChanged(object sender, GpioPinValueChangedEventArgs e)
 {
     if (e.Edge == GpioPinEdge.RisingEdge)
     {
         ButtonPressed?.Invoke();
     }
     else
     {
         ButtonReleased?.Invoke();
     }
 }
Ejemplo n.º 30
0
 private void CheckButton(string button, bool isPressed)
 {
     if (!m_ButtonStates.ContainsKey(button))
     {
         m_ButtonStates.Add(button, false);
     }
     if (m_ButtonStates[button] != isPressed)
     {
         m_ButtonStates[button] = isPressed;
         ButtonPressed?.Invoke(this, new ButtonPressedEventArgs(button, isPressed));
     }
 }
Ejemplo n.º 31
0
        private void UpdateTimer(Keys key, Buttons button, float directionX, float directionY, float elapsedTime, ButtonDown downAction, ButtonUp upAction, ButtonPressed pressAction, ref float downTimer, ref float upTimer)
        {
            if (IsKeyDown(key) || currentGamePadState.IsButtonDown(button))
            {
                if(downAction != null && downTimer == 0)
                    downAction.Invoke(directionX, directionY, upTimer, PlayerIndex);

                downTimer += elapsedTime;
                upTimer = 0;
            }
            else if (IsKeyUp(key) || currentGamePadState.IsButtonUp(button))
            {
                //Check if it was a press of key
                if(this.oldKeyboardState.IsKeyDown(key) || oldGamePadState.IsButtonDown(button)){
                    if (pressAction != null)
                        pressAction.Invoke(PlayerIndex);

                    if (upAction != null)
                        upAction.Invoke(downTimer, PlayerIndex);
                }
                upTimer += elapsedTime;
                downTimer = 0;
            }
        }