private void MouseGeter_MouseKeyDown(RawMouseEventArgs mkd)
 {
     OnMouseInput?.Invoke(null, new MouseHookEventArgs()
     {
         MouseInfo = mkd.MouseInfo, MouseMessage = mkd.MouseMessage, Point = mkd.Point
     });
 }
Example #2
0
 /// <summary>
 /// Invoke user callbacks with the argument
 /// </summary>
 /// <param name="kd"></param>
 private static void KListener_KeyDown(RawMouseEventArgs kd)
 {
     OnMouseInput?.Invoke(null, new MouseEventArgs()
     {
         Message = kd.Message, Point = kd.Point
     });
 }
        public void RegisterMouseUp(OnMouseInput _node)
        {
            if (onMouseUpInput == null)
            {
                onMouseUpInput = new List <OnMouseInput>();
            }

            onMouseUpInput.Add(_node);
        }
Example #4
0
    private void Update()
    {
        movementX       = Input.GetAxis("Horizontal") * transform.right;
        movementY       = Input.GetAxis("Vertical") * transform.forward;
        _inputDirection = movementX + movementY;
        OnMoveInput?.Invoke(_inputDirection);

        _mouseInput.x = Input.GetAxis("Mouse X") * mouseSensitivity;
        _mouseInput.y = Input.GetAxis("Mouse Y") * mouseSensitivity;
        OnMouseInput?.Invoke(_mouseInput);
    }
Example #5
0
        private void Update()
        {
            if (!IsInitialized)
            {
                return;
            }

            if (!CanInput)
            {
                return;
            }

            #region Click Detection

            for (int i = 0; i < 3; i++)
            {
                if (UnityEngine.Input.GetMouseButtonDown(i))
                {
                    lastPressedMousePosition[i] = UnityEngine.Input.mousePosition;
                    OnMouseInput?.Invoke((MouseButton)i, MouseEvent.Press);
                }

                if (UnityEngine.Input.GetMouseButtonUp(i))
                {
                    OnMouseInput?.Invoke((MouseButton)i, MouseEvent.Release);

                    if (Vector2.Distance(lastPressedMousePosition[i], UnityEngine.Input.mousePosition) <
                        mouseClickThreshold) //determine whether a click is valid
                    {
                        OnMouseInput?.Invoke((MouseButton)i, MouseEvent.Click);
                    }
                }

                if (UnityEngine.Input.GetMouseButton(i))
                {
                    OnMouseInput?.Invoke((MouseButton)i, MouseEvent.Hold);
                }
            }

            #endregion

            #region Inputs axis calcs

            foreach (KeyValuePair <string, KeyBinding> keyBinding in keyBindings)
            {
                if (UnityEngine.Input.GetKey(keyBinding.Value.PositiveKey) ||
                    UnityEngine.Input.GetKey(keyBinding.Value.AltPositiveKey))
                {
                    keyBinding.Value.RaiseValue();
                }
                else if (UnityEngine.Input.GetKey(keyBinding.Value.NegativeKey) ||
                         UnityEngine.Input.GetKey(keyBinding.Value.AltNegativeKey))
                {
                    keyBinding.Value.LowerValue();
                }
                else
                {
                    keyBinding.Value.MoveToNeutral();
                }
            }

            #endregion
        }
Example #6
0
 /// <summary>
 ///     Invoke user callbacks with the argument
 /// </summary>
 /// <param name="kd"></param>
 private void KListener_KeyDown(RawMouseEventArgs kd)
 {
     OnMouseInput?.Invoke(null, new MouseEventArgs {
         Message = kd.Message, Point = kd.Point, MouseData = kd.MouseData
     });
 }