Exemplo n.º 1
0
        void InputHandler.HandleInputs(List <Input> touches, Input mouse, Input pen)
        {
            if (Application.isEditor)
            {
                if (mouse.InputState == InputState.Moved)
                {
                    #if USING_UNITY_INPUT_SYSTEM
                    bool isLeftCtrlDown = UnityEngine.InputSystem.Keyboard.current.leftCtrlKey.isPressed;
                    #else
                    bool isLeftCtrlDown = UnityEngine.Input.GetKeyDown(KeyCode.LeftControl);
                    #endif

                    if (isLeftCtrlDown == false)
                    {
                        this.ProcessRotate(mouse);
                    }
                    else
                    {
                        // Creating a fake input in the center of the screen
                        Input fakeInput = new Input();
                        fakeInput.Reset(0, 0, InputType.Mouse, InputButton.Left, new Vector2(Screen.width / 2.0f, Screen.height / 2.0f));

                        this.ProcessZoom(mouse, fakeInput);
                    }
                }
            }
            else if (touches.Count == 1)
            {
                this.ProcessRotate(touches[0]);
            }
            else if (touches.Count > 1)
            {
                this.ProcessZoom(touches[0], touches[1]);
            }
        }
Exemplo n.º 2
0
        private Input GetNewInput(int unityFingerId, InputType inputType, InputButton inputButton, Vector2 position)
        {
            Debug.Assert(this.inputCache.Count != 0, "InputManager's input cache has run out!  Figure out why we're leaking inputs.");

            int   lastIndex = this.inputCache.Count - 1;
            Input lastInput = this.inputCache[lastIndex];

            this.inputCache.RemoveAt(lastIndex);

            lastInput.Reset(this.inputIdCounter++, unityFingerId, inputType, inputButton, position);

            return(lastInput);
        }