Ejemplo n.º 1
0
 public void Record(Vector3 virtualPointerPos)
 {
     _writer.Write(_inputWrapper.GetScreenRect().width);
     _writer.Write(_inputWrapper.GetScreenRect().height);
     _writer.Write(_inputWrapper.GetMousePosition().x);
     _writer.Write(_inputWrapper.GetMousePosition().y);
     _writer.Write(_inputWrapper.GetAxis("Mouse X"));
     _writer.Write(_inputWrapper.GetAxis("Mouse Y"));
     _writer.Write(_inputWrapper.GetMouseButton(0));
     _writer.Write(_inputWrapper.GetMouseButtonUp(0));
     _writer.Write(_inputWrapper.GetMouseButtonDown(0));
     _numFrames++;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Given a mouse button return the current state for the frame.
        /// </summary>
        /// <remarks>
        /// Copied from Unity UI's PointerInputModule.
        /// </remarks>
        protected new PointerEventData.FramePressState StateForMouseButton(int buttonId)
        {
            bool pressed  = _inputWrapper.GetMouseButtonDown(buttonId);
            bool released = _inputWrapper.GetMouseButtonUp(buttonId);

            PointerEventData.FramePressState state = PointerEventData.FramePressState.NotChanged;

            if (pressed && released)
            {
                state = PointerEventData.FramePressState.PressedAndReleased;
            }
            else if (pressed)
            {
                state = PointerEventData.FramePressState.Pressed;
            }
            else if (released)
            {
                state = PointerEventData.FramePressState.Released;
            }

            return(state);
        }