public XInputDevice(int deviceIndex, XInputDeviceManager owner) : base("XInput Controller") { this.owner = owner; DeviceIndex = deviceIndex; base.SortOrder = deviceIndex; base.Meta = "XInput Device #" + deviceIndex; base.DeviceClass = InputDeviceClass.Controller; base.DeviceStyle = InputDeviceStyle.XboxOne; AddControl(InputControlType.LeftStickLeft, "Left Stick Left", 0.2f, 0.9f); AddControl(InputControlType.LeftStickRight, "Left Stick Right", 0.2f, 0.9f); AddControl(InputControlType.LeftStickUp, "Left Stick Up", 0.2f, 0.9f); AddControl(InputControlType.LeftStickDown, "Left Stick Down", 0.2f, 0.9f); AddControl(InputControlType.RightStickLeft, "Right Stick Left", 0.2f, 0.9f); AddControl(InputControlType.RightStickRight, "Right Stick Right", 0.2f, 0.9f); AddControl(InputControlType.RightStickUp, "Right Stick Up", 0.2f, 0.9f); AddControl(InputControlType.RightStickDown, "Right Stick Down", 0.2f, 0.9f); AddControl(InputControlType.LeftTrigger, "Left Trigger", 0.2f, 0.9f); AddControl(InputControlType.RightTrigger, "Right Trigger", 0.2f, 0.9f); AddControl(InputControlType.DPadUp, "DPad Up", 0.2f, 0.9f); AddControl(InputControlType.DPadDown, "DPad Down", 0.2f, 0.9f); AddControl(InputControlType.DPadLeft, "DPad Left", 0.2f, 0.9f); AddControl(InputControlType.DPadRight, "DPad Right", 0.2f, 0.9f); AddControl(InputControlType.Action1, "A"); AddControl(InputControlType.Action2, "B"); AddControl(InputControlType.Action3, "X"); AddControl(InputControlType.Action4, "Y"); AddControl(InputControlType.LeftBumper, "Left Bumper"); AddControl(InputControlType.RightBumper, "Right Bumper"); AddControl(InputControlType.LeftStickButton, "Left Stick Button"); AddControl(InputControlType.RightStickButton, "Right Stick Button"); AddControl(InputControlType.Start, "Start"); AddControl(InputControlType.Back, "Back"); }
public static void Setup() { if (isSetup) { return; } Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; inputDeviceManagers.Clear(); Devices.Clear(); activeDevice = InputDevice.Null; isSetup = true; #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (enableXInput) { XInputDeviceManager.Enable(); } #endif AddDeviceManager(new UnityInputDeviceManager()); if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } }
internal static bool SetupInternal() { if (IsSetup) { return(false); } #if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_EDITOR_OSX && (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) Platform = (Utility.GetWindowsVersion() + " " + SystemInfo.deviceModel).ToUpper(); #else Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); #endif initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; deviceManagers.Clear(); deviceManagerTable.Clear(); devices.Clear(); Devices = new ReadOnlyCollection <InputDevice>(devices); activeDevice = InputDevice.Null; IsSetup = true; #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (EnableXInput) { XInputDeviceManager.Enable(); } #endif #if UNITY_IOS if (EnableICade) { ICadeDeviceManager.Enable(); } #endif if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } var addUnityInputDeviceManager = true; #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR addUnityInputDeviceManager = false; #endif if (addUnityInputDeviceManager) { AddDeviceManager <UnityInputDeviceManager>(); } return(true); }
internal static void SetupInternal() { if (isSetup) { return; } Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; inputDeviceManagers.Clear(); devices.Clear(); Devices = new ReadOnlyCollection <InputDevice>(devices); activeDevice = InputDevice.Null; isSetup = true; #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (enableXInput) { XInputDeviceManager.Enable(); } if (enablePS4Win) { PS4WinDeviceManager.Enable(); } #endif if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } var addUnityInputDeviceManager = true; #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR addUnityInputDeviceManager = false; #endif if (addUnityInputDeviceManager) { AddDeviceManager <UnityInputDeviceManager>(); } }
public XInputDevice(int deviceIndex, XInputDeviceManager owner) : base("XInput Controller") { this.owner = owner; DeviceIndex = deviceIndex; SortOrder = deviceIndex; Meta = "XInput Device #" + deviceIndex; DeviceClass = InputDeviceClass.Controller; DeviceStyle = InputDeviceStyle.XboxOne; 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, "Left Trigger", LowerDeadZone, UpperDeadZone); AddControl(InputControlType.RightTrigger, "Right Trigger", 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, "A"); AddControl(InputControlType.Action2, "B"); AddControl(InputControlType.Action3, "X"); AddControl(InputControlType.Action4, "Y"); AddControl(InputControlType.LeftBumper, "Left Bumper"); AddControl(InputControlType.RightBumper, "Right Bumper"); AddControl(InputControlType.LeftStickButton, "Left Stick Button"); AddControl(InputControlType.RightStickButton, "Right Stick Button"); AddControl(InputControlType.View, "View"); AddControl(InputControlType.Menu, "Menu"); }
public static void Enable() { var errors = new List <string>(); if (XInputDeviceManager.CheckPlatformSupport(errors)) { InputManager.HideDevicesWithProfile(typeof(Xbox360WinProfile)); InputManager.HideDevicesWithProfile(typeof(LogitechF710ModeXWinProfile)); InputManager.AddDeviceManager(new XInputDeviceManager()); } else { foreach (var error in errors) { Logger.LogError(error); } } }
public XInputDevice( int deviceIndex, XInputDeviceManager owner ) : base( "XInput Controller" ) { this.owner = owner; DeviceIndex = deviceIndex; SortOrder = deviceIndex; Meta = "XInput Device #" + deviceIndex; 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, "Left Trigger", LowerDeadZone, UpperDeadZone ); AddControl( InputControlType.RightTrigger, "Right Trigger", 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, "A" ); AddControl( InputControlType.Action2, "B" ); AddControl( InputControlType.Action3, "X" ); AddControl( InputControlType.Action4, "Y" ); AddControl( InputControlType.LeftBumper, "Left Bumper" ); AddControl( InputControlType.RightBumper, "Right Bumper" ); AddControl( InputControlType.LeftStickButton, "Left Stick Button" ); AddControl( InputControlType.RightStickButton, "Right Stick Button" ); AddControl( InputControlType.Start, "Start" ); AddControl( InputControlType.Back, "Back" ); }
public XInputDevice(int deviceIndex, XInputDeviceManager owner) : base("XInput Controller") { this.owner = owner; DeviceIndex = deviceIndex; SortOrder = deviceIndex; Meta = "XInput Device #" + deviceIndex; 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, "Left Trigger", LowerDeadZone, UpperDeadZone); AddControl(InputControlType.RightTrigger, "Right Trigger", 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, "A"); AddControl(InputControlType.Action2, "B"); AddControl(InputControlType.Action3, "X"); AddControl(InputControlType.Action4, "Y"); AddControl(InputControlType.LeftBumper, "Left Bumper"); AddControl(InputControlType.RightBumper, "Right Bumper"); AddControl(InputControlType.LeftStickButton, "Left Stick Button"); AddControl(InputControlType.RightStickButton, "Right Stick Button"); AddControl(InputControlType.Start, "Start"); AddControl(InputControlType.Back, "Back"); }
internal static bool SetupInternal() { if (IsSetup) { return(false); } Platform = Utility.GetWindowsVersion().ToUpper(); enabled = true; initialTime = 0f; currentTime = 0f; lastUpdateTime = 0f; currentTick = 0uL; applicationIsFocused = true; deviceManagers.Clear(); deviceManagerTable.Clear(); devices.Clear(); Devices = new ReadOnlyCollection <InputDevice>(devices); activeDevice = InputDevice.Null; playerActionSets.Clear(); IsSetup = true; bool flag = true; if (EnableNativeInput && NativeInputDeviceManager.Enable()) { flag = false; } if (EnableXInput && flag) { XInputDeviceManager.Enable(); } if (InputManager.OnSetup != null) { InputManager.OnSetup(); InputManager.OnSetup = null; } if (flag) { AddDeviceManager <UnityInputDeviceManager>(); } return(true); }
internal static bool SetupInternal() { if (IsSetup) { return(false); } #if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_EDITOR_OSX && (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) Platform = Utility.GetWindowsVersion().ToUpper(); #else Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); #endif enabled = true; initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; applicationIsFocused = true; deviceManagers.Clear(); deviceManagerTable.Clear(); devices.Clear(); Devices = devices.AsReadOnly(); activeDevice = InputDevice.Null; activeDevices.Clear(); ActiveDevices = activeDevices.AsReadOnly(); playerActionSets.Clear(); // TO DO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive? // Currently it's used to verify we're in or after setup for various functions that are // called during manager initialization. There should be a safer way... maybe add IsReset? IsSetup = true; var enableUnityInput = true; var nativeInputIsEnabled = EnableNativeInput && NativeInputDeviceManager.Enable(); if (nativeInputIsEnabled) { enableUnityInput = false; } #if ENABLE_WINMD_SUPPORT && !UNITY_XBOXONE && !UNITY_EDITOR if (UWPDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (EnableXInput && enableUnityInput) { XInputDeviceManager.Enable(); } #endif #if UNITY_IOS || UNITY_TVOS if (EnableICade) { ICadeDeviceManager.Enable(); } #endif #if UNITY_XBOXONE if (XboxOneInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_SWITCH if (NintendoSwitchInputDeviceManager.Enable()) { enableUnityInput = false; } #endif // TO DO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive? // Currently, it allows use of InputManager.HideDevicesWithProfile() to be called in OnSetup, which is possibly useful? if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR enableUnityInput = false; #endif if (enableUnityInput) { AddDeviceManager <UnityInputDeviceManager>(); } return(true); }
internal static bool SetupInternal() { if (IsSetup) { return(false); } #if !NETFX_CORE && !UNITY_WEBPLAYER && !UNITY_EDITOR_OSX && (UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN) Platform = Utility.GetWindowsVersion().ToUpper(); #else Platform = (SystemInfo.operatingSystem + " " + SystemInfo.deviceModel).ToUpper(); #endif enabled = true; initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; applicationIsFocused = true; deviceManagers.Clear(); deviceManagerTable.Clear(); devices.Clear(); Devices = new ReadOnlyCollection <InputDevice>(devices); activeDevice = InputDevice.Null; playerActionSets.Clear(); // TODO: Can this move further down along with the OnSetup callback? IsSetup = true; var enableUnityInput = true; var nativeInputIsEnabled = EnableNativeInput && NativeInputDeviceManager.Enable(); if (nativeInputIsEnabled) { enableUnityInput = false; } #if UNITY_STANDALONE_WIN || UNITY_EDITOR if (EnableXInput && enableUnityInput) { XInputDeviceManager.Enable(); } #endif #if UNITY_IOS if (EnableICade) { ICadeDeviceManager.Enable(); } #endif #if UNITY_XBOXONE if (XboxOneInputDeviceManager.Enable()) { enableUnityInput = false; } #endif // TODO: Can this move further down after the UnityInputDeviceManager is added? // Currently, it allows use of InputManager.HideDevicesWithProfile() if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR enableUnityInput = false; #endif if (enableUnityInput) { AddDeviceManager <UnityInputDeviceManager>(); } return(true); }
internal static bool SetupInternal() { if (IsSetup) { return(false); } Platform = Utility.GetPlatformName(); enabled = true; initialTime = 0.0f; currentTime = 0.0f; lastUpdateTime = 0.0f; currentTick = 0; applicationIsFocused = true; deviceManagers.Clear(); deviceManagerTable.Clear(); devices.Clear(); Devices = devices.AsReadOnly(); activeDevice = InputDevice.Null; activeDevices.Clear(); ActiveDevices = activeDevices.AsReadOnly(); playerActionSets.Clear(); MouseProvider = new UnityMouseProvider(); MouseProvider.Setup(); KeyboardProvider = new UnityKeyboardProvider(); KeyboardProvider.Setup(); // TODO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive? // Currently it's used to verify we're in or after setup for various functions that are // called during manager initialization. There should be a safer way... maybe add IsReset? IsSetup = true; var enableUnityInput = true; var nativeInputIsEnabled = EnableNativeInput && NativeInputDeviceManager.Enable(); if (nativeInputIsEnabled) { enableUnityInput = false; } #if ENABLE_WINMD_SUPPORT && !UNITY_XBOXONE && !UNITY_EDITOR if (UWPDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_XBOXONE if (XboxOneInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_GAMECORE if (GameCoreInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_SWITCH if (NintendoSwitchInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_STADIA if (StadiaInputDeviceManager.Enable()) { enableUnityInput = false; } #endif #if UNITY_STANDALONE_WIN || UNITY_EDITOR_WIN if (EnableXInput && enableUnityInput) { XInputDeviceManager.Enable(); } #endif #if UNITY_IOS || UNITY_TVOS if (EnableICade) { ICadeDeviceManager.Enable(); } #endif // TODO: Can this move further down after the UnityInputDeviceManager is added, which is more intuitive? // Currently, it allows use of InputManager.HideDevicesWithProfile() to be called in OnSetup, which is possibly useful? if (OnSetup != null) { OnSetup.Invoke(); OnSetup = null; } #if UNITY_ANDROID && INCONTROL_OUYA && !UNITY_EDITOR enableUnityInput = false; #endif if (enableUnityInput) { #if INCONTROL_USE_NEW_UNITY_INPUT AddDeviceManager <NewUnityInputDeviceManager>(); #else AddDeviceManager <UnityInputDeviceManager>(); #endif } return(true); }