示例#1
0
 private void up_Pushed(object sender, EventArgs e)
 {
     if (Up != null)
     {
         Up.Invoke(this, e);
     }
 }
示例#2
0
    void Swipe()
    {
        Vector2 delta = Input.GetTouch(0).deltaPosition; //фмксируем дельту тачеи

        if (Mathf.Abs(delta.x) > Mathf.Abs(delta.y))     //тач по горизонтали
        {
            if (delta.x > 0)                             //свеип вправо
            {
                Right?.Invoke();
            }
            else //свеип влево
            {
                Left?.Invoke();
            }
        }
        else //тач по вертикали
        {
            if (delta.y > 0) //свеип вверх
            {
                Up?.Invoke();
            }
            else //свеип вниз
            {
                Down?.Invoke();
            }
        }
    }
示例#3
0
文件: InputButton.cs 项目: Bgoon/GKit
        internal void UpdateState(bool onHold)
        {
            IsDown = false;
            IsUp   = false;

            if (IsHold)
            {
                if (!onHold)
                {
                    IsUp = true;

                    UpOnce?.Invoke();
                    UpOnce = null;
                    Up?.Invoke();
                }
            }
            else
            {
                if (onHold)
                {
                    IsDown = true;
                    DownOnce?.Invoke();
                    DownOnce = null;
                    Down?.Invoke();
                }
            }

            IsHold = onHold;
            if (onHold)
            {
                HoldOnce?.Invoke();
                HoldOnce = null;
                Hold?.Invoke();
            }
        }
示例#4
0
        private void RegistEvent()
        {
            inputHandler.Click += data => { if (Enable)
                                            {
                                                Click?.Invoke(this, data);
                                            }
            };

            inputHandler.Enter += data => { if (Enable)
                                            {
                                                Enter?.Invoke(this, data);
                                            }
            };
            inputHandler.Exit += data => { if (Enable)
                                           {
                                               Exit?.Invoke(this, data);
                                           }
            };

            inputHandler.Down += data => { if (Enable)
                                           {
                                               Down?.Invoke(this, data);
                                           }
            };
            inputHandler.Up += data => { if (Enable)
                                         {
                                             Up?.Invoke(this, data);
                                         }
            };
        }
示例#5
0
 private void toolStripButtonUp_Click(object sender, EventArgs e)
 {
     try
     {
         Up?.Invoke(this, EventArgs.Empty);
         if (str != null)
         {
             DravItem();
         }
     }
     catch (Exception ex) { Remove_Die_Path?.Invoke(this, EventArgs.Empty); MessageBox.Show(ex.Message); }
 }
 public void UpRate(double up)
 {
     if (up < 0)
     {
         Up?.Invoke("Invalid input");
     }
     else
     {
         AverageRate += up;
         Up?.Invoke($"Current rate is {AverageRate}");
     }
 }
示例#7
0
        /// <summary>
        /// Returns true if the host was DOWN and it was set as UP.
        /// </summary>
        public bool BringUpIfDown()
        {
            var wasUp = Interlocked.CompareExchange(ref _isUpNow, 1, 0) == 1;

            if (wasUp)
            {
                return(false);
            }
            Logger.Info("Host {0} is now UP", Address);
            Up?.Invoke(this);
            return(true);
        }
    int KeyProc(int code, int wParam, IntPtr lParam)
    {
        int NextHook() => CallNextHookEx(hookHandle, code, wParam, lParam);

        if (code < 0)
        {
            return(NextHook());
        }

        bool shift     = (GetKeyState(0x10) & 0x80) == 0x80;
        bool ctrl      = (GetKeyState(0x11) & 0x80) == 0x80;
        Keys modifiers = (shift ? Keys.Shift : Keys.None) | (ctrl ? Keys.Control : Keys.None);

        KeyMessage   message = (KeyMessage)Marshal.PtrToStructure(lParam, typeof(KeyMessage));
        KeyEventArgs e       = new KeyEventArgs((Keys)message.VirtualKeyCode | modifiers);

        switch (wParam)
        {
        case 0x100:  // WM_KEYDOWN
        case 0x104:  // WM_SYSKEYDOWN
            if (Down != null)
            {
                Down.Invoke(null, e);
            }
            if (e.Handled)
            {
                return(-1);
            }
            break;

        case 0x101:  // WM_KEYUP
        case 0x105:  // WM_SYSKEYUP
            if (Up != null)
            {
                Up.Invoke(null, e);
            }
            if (e.Handled)
            {
                return(-1);
            }
            break;
        }

        return(NextHook());
    }
示例#9
0
        internal void MoveDiamonds(ConsoleKey inputKey)
        {
            switch (inputKey)
            {
            case ConsoleKey.LeftArrow:
                Left?.Invoke(this, null);
                break;

            case ConsoleKey.RightArrow:
                Right?.Invoke(this, null);
                break;

            case ConsoleKey.UpArrow:
                Up?.Invoke(this, null);
                break;

            case ConsoleKey.DownArrow:
                Down?.Invoke(this, null);
                break;
            }
        }
示例#10
0
        private int Proc(int Code, int wParam, ref KeyStructure lParam)
        {
            if (Code == 0)
            {
                switch (wParam)
                {
                case 0x100:
                case 0x104:
                {
                    Down?.Invoke(Feed((Keys)lParam.Code));
                    break;
                }

                case 0x101:
                case 0x105:
                {
                    Up?.Invoke(Feed((Keys)lParam.Code));
                    break;
                }
                }
            }

            return(CallNextHookEx(Key, Code, wParam, ref lParam));
        }
示例#11
0
 public void OnPointerUp(PointerEventData eventData)
 {
     Up?.Invoke(eventData.position);
 }
示例#12
0
 public void OnPointerUp(PointerEventData eventData) => Up?.Invoke(eventData);
示例#13
0
 private void UpButton_OnClick(object sender, RoutedEventArgs e)
 {
     Up?.Invoke(this, EventArgs.Empty);
 }
示例#14
0
 void UpResponse(ButtonUpResponse status)
 {
     //fire the event
     Up?.Invoke(_arm, new DataEventArg <ButtonUpResponse>(status));
 }
示例#15
0
 public static void OnUp(Point p)
 {
     Up?.Invoke(p);
     _panJustBegun = false;
 }
示例#16
0
 private void OnHostUp(Host sender)
 {
     Up?.Invoke(sender);
 }
示例#17
0
 public void OnPointerUp(PointerEventData eventData)
 {
     Up?.Invoke(gameObject);
 }
示例#18
0
 private void upButton_Click(object sender, EventArgs e)
 {
     Up?.Invoke();
 }
        /// <summary>Atualiza o componente.</summary>
        /// <param name="gameTime">Fornece acesso aos valores de tempo do jogo.</param>
        protected override void _Update(GameTime gameTime)
        {
            dclickTime += gameTime.ElapsedGameTime.Milliseconds;

            if (dclickTime > DoubleClickDelay)
            {
                dclickTime = 0;
                clicks     = 0;
            }

            Rectangle bounds = Actor.Bounds;
            Screen    screen = Screen;

            old   = state;
            state = Mouse.GetState();

            //Se o ponteiro do mouse consta como dentro dos limites
            if (mouseOn)
            {
                //mas verificando novamente ele consta fora
                if (!bounds.Contains(state.Position))
                {
                    Leave?.Invoke(Actor, state);
                }
            }

            //se o ponteiro do mouse está dentro dos limites da entidade.
            if (bounds.Contains(state.Position))
            {
                //se o ponteiro do mouse se encontrava fora
                if (!mouseOn)
                {
                    Enter?.Invoke(Actor, state);
                }

                mouseOn = true;
                On?.Invoke(Actor, state);

                //se um botão foi pressionado enquanto o controle está dentro
                if (state.LeftButton == ButtonState.Pressed ||
                    state.RightButton == ButtonState.Pressed ||
                    state.MiddleButton == ButtonState.Pressed)
                {
                    //old = state;
                    Down?.Invoke(Actor, state);
                }

                //se um botão foi liberado
                if (old.LeftButton == ButtonState.Pressed && state.LeftButton == ButtonState.Released ||
                    old.RightButton == ButtonState.Pressed && state.RightButton == ButtonState.Released ||
                    old.MiddleButton == ButtonState.Pressed && state.MiddleButton == ButtonState.Released)
                {
                    Up?.Invoke(Actor, state);
                }

                //Verifica se houve clique duplo
                if (old.LeftButton == ButtonState.Released && state.LeftButton == ButtonState.Pressed)
                {
                    clicks++;
                    dclickTime = 0;

                    if (clicks >= 2 && dclickTime < DoubleClickDelay)
                    {
                        DoubleClick?.Invoke(Actor, state);
                        clicks     = 0;
                        dclickTime = 0;
                    }
                }
            }
            else
            {
                mouseOn = false;
                //old = state;
            }
        }
示例#20
0
 private void OnUp(KeyboardEventArgs value)
 {
     Up?.Invoke(this, value, PushToThreadPool);
 }
示例#21
0
 public void Upsalary(int amount, Worker person)
 {
     Up?.Invoke(amount, person);
 }
示例#22
0
 public void OnUp(JuniperPointerEventData evt)
 {
     IsPressed = false;
     onUp?.Invoke(evt);
     Up?.Invoke(this, evt);
 }