public float scale;             // General scale of device
 private void Defaults()
 {
     fileDevice     = "";
     fileScreenshot = "";
     style          = DeviceStyle.DrawTop;
     pos            = new Position();
     scale          = 1.0f;
 }
Пример #2
0
        public NewUnityInputDevice(UnityInput.Gamepad unityGamepad)
        {
            UnityGamepad = unityGamepad;

            SortOrder = unityGamepad.deviceId;

            DeviceClass = InputDeviceClass.Controller;
            DeviceStyle = DetectDeviceStyle(unityGamepad);

            leftCommandControl  = DeviceStyle.LeftCommandControl();
            rightCommandControl = DeviceStyle.RightCommandControl();

            Name = unityGamepad.displayName;
            Meta = unityGamepad.displayName;

            AddControl(InputControlType.LeftStickLeft, "Left Stick Left", lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.LeftStickRight, "Left Stick Right", lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.LeftStickUp, "Left Stick Up", lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.LeftStickDown, "Left Stick Down", lowerDeadZone, upperDeadZone);

            AddControl(InputControlType.RightStickLeft, "Right Stick Left", lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.RightStickRight, "Right Stick Right", lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.RightStickUp, "Right Stick Up", lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.RightStickDown, "Right Stick Down", lowerDeadZone, upperDeadZone);

            AddControl(InputControlType.LeftTrigger, unityGamepad.leftTrigger.displayName, lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.RightTrigger, unityGamepad.rightTrigger.displayName, lowerDeadZone, upperDeadZone);

            AddControl(InputControlType.DPadUp, "DPad Up", lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.DPadDown, "DPad Down", lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.DPadLeft, "DPad Left", lowerDeadZone, upperDeadZone);
            AddControl(InputControlType.DPadRight, "DPad Right", lowerDeadZone, upperDeadZone);

            AddControl(InputControlType.Action1, unityGamepad.buttonWest.displayName);
            AddControl(InputControlType.Action2, unityGamepad.buttonNorth.displayName);
            AddControl(InputControlType.Action3, unityGamepad.buttonEast.displayName);
            AddControl(InputControlType.Action4, unityGamepad.buttonSouth.displayName);

            AddControl(InputControlType.LeftBumper, unityGamepad.leftShoulder.displayName);
            AddControl(InputControlType.RightBumper, unityGamepad.rightShoulder.displayName);

            AddControl(InputControlType.LeftStickButton, unityGamepad.leftStickButton.displayName);
            AddControl(InputControlType.RightStickButton, unityGamepad.rightStickButton.displayName);

            AddControl(leftCommandControl, unityGamepad.selectButton.displayName);
            AddControl(rightCommandControl, unityGamepad.startButton.displayName);

            // foreach (var control in unityGamepad.allControls)
            // {
            //  Debug.Log( $"{control.displayName}, {control.shortDisplayName}" );
            // }
        }
Пример #3
0
        void AddAliasControls()
        {
            RemoveAliasControls();

            if (IsKnown)
            {
                LeftStick  = new TwoAxisInputControl();
                RightStick = new TwoAxisInputControl();

                DPad = new TwoAxisInputControl();
                DPad.DeadZoneFunc = DeadZone.Separate;

                AddControl(InputControlType.LeftStickX, "Left Stick X");
                AddControl(InputControlType.LeftStickY, "Left Stick Y");
                AddControl(InputControlType.RightStickX, "Right Stick X");
                AddControl(InputControlType.RightStickY, "Right Stick Y");
                AddControl(InputControlType.DPadX, "DPad X");
                AddControl(InputControlType.DPadY, "DPad Y");

                                #if UNITY_PS4
                AddControl(InputControlType.Command, "OPTIONS button");
                                #else
                AddControl(InputControlType.Command, "Command");
                                #endif

                LeftCommandControl    = DeviceStyle.LeftCommandControl();
                leftCommandSource     = GetControl(LeftCommandControl);
                hasLeftCommandControl = !leftCommandSource.IsNullControl;
                if (hasLeftCommandControl)
                {
                    AddControl(InputControlType.LeftCommand, leftCommandSource.Handle);
                }

                RightCommandControl    = DeviceStyle.RightCommandControl();
                rightCommandSource     = GetControl(RightCommandControl);
                hasRightCommandControl = !rightCommandSource.IsNullControl;
                if (hasRightCommandControl)
                {
                    AddControl(InputControlType.RightCommand, rightCommandSource.Handle);
                }

                ExpireControlCache();
            }
        }
 public Device(string f1, string f2, DeviceStyle st, Position p, float sc)
 {
     Defaults();
     fileDevice = f1; fileScreenshot = f2; style = st; pos = p; scale = sc;
 }