Exemplo n.º 1
0
 private void pictureBox_MouseClick(object sender, MouseEventArgs e)
 {
     if (OnMouseClicked != null)
     {
         OnMouseClicked.Invoke(e);
     }
 }
Exemplo n.º 2
0
 internal void InvokeMouseClicked(float mouseX, float mouseY)
 {
     if (Enabled)
     {
         OnMouseClicked?.Invoke(this, mouseX - Transform.Position.X, mouseY - Transform.Position.Y);
     }
 }
Exemplo n.º 3
0
 void MouseControl()
 {
     if (Input.GetMouseButtonDown(0) && hitInfo.collider != null)
     {
         if (hitInfo.collider.gameObject.CompareTag("Ground"))
         {
             OnMouseClicked?.Invoke(hitInfo.point);
         }
         if (hitInfo.collider.gameObject.CompareTag("Enemy"))
         {
             OnEnemyClicked?.Invoke(hitInfo.collider.gameObject);
         }
         if (hitInfo.collider.gameObject.CompareTag("Attackable"))
         {
             OnEnemyClicked?.Invoke(hitInfo.collider.gameObject);
         }
         if (hitInfo.collider.gameObject.CompareTag("Portal"))
         {
             OnMouseClicked?.Invoke(hitInfo.point);
         }
         if (hitInfo.collider.gameObject.CompareTag("Item"))
         {
             OnMouseClicked?.Invoke(hitInfo.point);
         }
     }
 }
Exemplo n.º 4
0
 //Can't deal with right clicks on MouseClick callback
 private void OnMouseOver()
 {
     if (Input.GetMouseButtonDown(0))
     {
         OnMouseClicked?.Invoke(this, new MouseButtonClickEventArgs(MouseButtonClickEventArgs.MouseType.Left));
     }
     else if (Input.GetMouseButtonDown(1))
     {
         OnMouseClicked?.Invoke(this, new MouseButtonClickEventArgs(MouseButtonClickEventArgs.MouseType.Right));
     }
 }
Exemplo n.º 5
0
        private void OnMouseButtonPressed(MouseButton button, int x, int y)
        {
            if (button.button == MouseButtons.Left)
            {
                MouseEventArgs args = new MouseEventArgs(button.button, 1, x, y, 0);

                // Invoke on another thread to prevent blocking the hook chain
                Task.Run(() =>
                {
                    OnMouseClicked?.Invoke(this, args);
                });
            }
        }
Exemplo n.º 6
0
 private void Pipeclient_ServerMessage(NamedPipeConnection <JavaEvent, JavaEvent> connection, JavaEvent message)
 {
     if (message.action == "javaShutDown")
     {
         OnJavaShutDown?.Invoke(message.vmID);
     }
     if (message.action == "MouseClicked")
     {
         OnMouseClicked?.Invoke(message.vmID, new AccessibleContextNode(accessBridge, new JavaObjectHandle(message.vmID, new JOBJECT64(message.ac))));
     }
     if (message.action == "MouseEntered")
     {
         OnMouseEntered?.Invoke(message.vmID, new AccessibleContextNode(accessBridge, new JavaObjectHandle(message.vmID, new JOBJECT64(message.ac))));
     }
 }
Exemplo n.º 7
0
        private void MessageLoop()
        {
            foreach (HookMessage message in hooker.MessageQueue.GetConsumingEnumerable())
            {
                /*  ProcessNewTagReceivedLogic(tag);
                 * Console.WriteLine("Process Buffer #Tag {0}. Buffer Count #{1}", tag.NewLoopId, LogicBuffer.Count);*/
                if (message.messageType == HookMessageType.KeyDown)
                {
                    OnKeyReleased?.Invoke(this, new KeyEventArgs(message.key));
                }
                else if (message.messageType == HookMessageType.KeyUp)
                {
                    OnKeyPressed?.Invoke(this, new KeyEventArgs(message.key));
                }
                else if (message.messageType == HookMessageType.MouseDown)
                {
                    OnMouseClicked?.Invoke(this, new MouseEventArgs(message.mouseButton, 1, message.mouseX, message.mouseY, 0));
                }
            }

            /* while (true)
             * {
             *   if (cancelToken.IsCancellationRequested)
             *       return;
             *
             *
             *
             *   /*if (hooker.HasMessageAvailable)
             *   {
             *       HookMessage message = hooker.NextMessage;
             *       if (message.messageType == HookMessageType.KeyDown)
             *       {
             *           OnKeyReleased?.Invoke(this, new KeyEventArgs(message.key));
             *       }
             *       else if (message.messageType == HookMessageType.KeyUp)
             *       {
             *           OnKeyPressed?.Invoke(this, new KeyEventArgs(message.key));
             *       }
             *       else if (message.messageType == HookMessageType.MouseDown)
             *       {
             *           OnMouseClicked?.Invoke(this, new MouseEventArgs(message.mouseButton, 1, message.mouseX, message.mouseY, 0));
             *       }
             *   }
             *   await Task.Delay(10);
             * }*/
        }
Exemplo n.º 8
0
 public void MouseClicked(MouseButtons button)
 {
     OnMouseClicked?.Invoke(button);
 }
Exemplo n.º 9
0
        public void Update(GameTime gameTime)
        {
            _currentState = Mouse.GetState();

            #region mouse clicked

            if (_currentState.RightButton == ButtonState.Released &&
                _previousState.RightButton == ButtonState.Pressed)
            {
                OnMouseClicked?.Invoke(MouseButtonID.Right, gameTime);
            }

            if (_currentState.LeftButton == ButtonState.Released &&
                _previousState.LeftButton == ButtonState.Pressed)
            {
                OnMouseClicked?.Invoke(MouseButtonID.Left, gameTime);
            }

            if (_currentState.MiddleButton == ButtonState.Released &&
                _previousState.MiddleButton == ButtonState.Pressed)
            {
                OnMouseClicked?.Invoke(MouseButtonID.Middle, gameTime);
            }

            #endregion

            #region mouse down

            if ((_previousState.LeftButton == ButtonState.Pressed &&
                 _previousState.Position != _currentState.Position) ||
                _previousState.LeftButton == ButtonState.Released)
            {
                if (_currentState.LeftButton == ButtonState.Pressed)
                {
                    OnMouseDown?.Invoke(MouseButtonID.Left, gameTime);
                }
            }

            if ((_previousState.MiddleButton == ButtonState.Pressed &&
                 _previousState.Position != _currentState.Position) ||
                _previousState.MiddleButton == ButtonState.Released)
            {
                if (_currentState.MiddleButton == ButtonState.Pressed)
                {
                    OnMouseDown?.Invoke(MouseButtonID.Middle, gameTime);
                }
            }

            if ((_previousState.RightButton == ButtonState.Pressed &&
                 _previousState.Position != _currentState.Position) ||
                _previousState.RightButton == ButtonState.Released)
            {
                if (_currentState.RightButton == ButtonState.Pressed)
                {
                    OnMouseDown?.Invoke(MouseButtonID.Right, gameTime);
                }
            }

            #endregion

            if (_currentState.ScrollWheelValue != _previousState.ScrollWheelValue)
            {
                var scrollValue = _currentState.ScrollWheelValue - _previousState.ScrollWheelValue;
                var direction   = MouseScrollDirection.Up;
                if ((_currentState.ScrollWheelValue - _previousState.ScrollWheelValue) < 0)
                {
                    direction = MouseScrollDirection.Down;
                }

                OnMouseScroll?.Invoke(direction, _currentState.ScrollWheelValue, gameTime);
            }

            if (_currentState.Position != _previousState.Position)
            {
                OnMouseMoved?.Invoke(new Vector2(_previousState.X, _previousState.Y), gameTime);
            }

            _previousState = _currentState;
        }
Exemplo n.º 10
0
 private void OnMouseClick(object sender, MouseEventArgs e)
 {
     OnMouseClicked?.Invoke(sender, e);
 }
Exemplo n.º 11
0
 private void _OnMouseClicked(int vmID, IntPtr jevent, IntPtr ac) => OnMouseClicked?.Invoke(vmID, jevent, ac);
Exemplo n.º 12
0
 internal void InvokeMouseClicked(float mouseX, float mouseY)
 {
     OnMouseClicked?.Invoke(this, mouseX - Transform.Position.x, mouseY - Transform.Position.y);
 }