コード例 #1
0
        private void HandleSimulateFingers()
        {
            // Simulate pinch & twist?
            if (LeanInput.GetMouseExists() == true && LeanInput.GetKeyboardExists() == true)
            {
                var mousePosition = LeanInput.GetMousePosition();
                var mouseSet      = false;
                var mouseUp       = false;

                for (var i = 0; i < 5; i++)
                {
                    mouseSet |= LeanInput.GetMousePressed(i);
                    mouseUp  |= LeanInput.GetMouseUp(i);
                }

                if (mouseSet == true || mouseUp == true)
                {
                    if (LeanInput.GetPressed(MovePivotKey) == true)
                    {
                        pivot.x = mousePosition.x / Screen.width;
                        pivot.y = mousePosition.y / Screen.height;
                    }

                    if (LeanInput.GetPressed(PinchTwistKey) == true)
                    {
                        var center = new Vector2(Screen.width * pivot.x, Screen.height * pivot.y);

                        cachedTouch.AddFinger(-2, center - (mousePosition - center), 1.0f, mouseSet);
                    }
                    // Simulate multi drag?
                    else if (LeanInput.GetPressed(MultiDragKey) == true)
                    {
                        cachedTouch.AddFinger(-2, mousePosition, 1.0f, mouseSet);
                    }
                }
            }
        }