diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/DualShockController_D.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/DualShockController_D.cs new file mode 100644 index 00000000..fac26789 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/DualShockController_D.cs @@ -0,0 +1,28 @@ +namespace AxibugEmuOnline.Client.InputDevices +{ + /// <summary> PS3,PS4控制器 </summary> + public class DualShockController_D : InputDevice_D + { + public Button_C Circle; + public Button_C Triangle; + public Button_C Cross; + public Button_C Square; + public Button_C Up; + public Button_C Down; + public Button_C Left; + public Button_C Right; + public Button_C L1; + public Button_C L2; + public Button_C L3; + public Button_C R1; + public Button_C R2; + public Button_C R3; + public Button_C Share; + public Button_C Options; + public Button_C TouchpadBtn; + public Stick_C LeftStick; + public Stick_C RightStick; + + public DualShockController_D(InputResolver resolver) : base(resolver) { } + } +} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/DualShockController_D.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/DualShockController_D.cs.meta new file mode 100644 index 00000000..b602453a --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/DualShockController_D.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: e1f707631f22b4843840696ce2f66471 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/XboxController_D.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/XboxController_D.cs new file mode 100644 index 00000000..41380b27 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/XboxController_D.cs @@ -0,0 +1,27 @@ +namespace AxibugEmuOnline.Client.InputDevices +{ + public class XboxController_D : InputDevice_D + { + public Button_C X; + public Button_C Y; + public Button_C A; + public Button_C B; + public Button_C Up; + public Button_C Down; + public Button_C Left; + public Button_C Right; + public Button_C View; + public Button_C Menu; + public Button_C LeftBumper; + public Button_C LeftTrigger; + public Button_C LeftStickPress; + public Button_C RightBumper; + public Button_C RightTrigger; + public Button_C RightStickPress; + public Stick_C LeftStick; + public Stick_C RightStick; + + + public XboxController_D(InputResolver resolver) : base(resolver) { } + } +} \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/XboxController_D.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/XboxController_D.cs.meta new file mode 100644 index 00000000..fb344f7b --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/Devices/XboxController_D.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 5f0e5bba332725e45bb53ac32c4ee6d2 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputSystemResolver.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputSystemResolver.cs index 9ac5ddeb..82f226ce 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputSystemResolver.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputSystemResolver.cs @@ -5,6 +5,9 @@ using System.Collections.Generic; using UnityEditor.Experimental.GraphView; using UnityEngine; using UnityEngine.InputSystem; +using UnityEngine.InputSystem.DualShock; +using UnityEngine.InputSystem.Haptics; +using UnityEngine.InputSystem.XInput; namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem { @@ -24,7 +27,9 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem { InputDevice_D newDevice = null; if (ipdev is Keyboard) newDevice = new Keyboard_D(this); - else if (ipdev is Gamepad) newDevice = new GamePad_D(this); + else if (ipdev is DualShockGamepad) newDevice = new DualShockController_D(this); + else if (ipdev is XInputController) newDevice = new XboxController_D(this); + else if (ipdev is Gamepad) newDevice = new GamePad_D(this); //注意Gamepad的优先级,因为任何手柄,Inputsystem中的基类都是GamePad if (newDevice != null) { @@ -221,6 +226,52 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem mapper[keyboard_d.Semicolon] = ipKeyboard.semicolonKey; mapper[keyboard_d.Quote] = ipKeyboard.quoteKey; } + else if (device_d is DualShockController_D ds_d) + { + var ipDsGamePad = ipdevice as DualShockGamepad; + mapper[ds_d.Circle] = ipDsGamePad.circleButton; + mapper[ds_d.Triangle] = ipDsGamePad.triangleButton; + mapper[ds_d.Cross] = ipDsGamePad.crossButton; + mapper[ds_d.Square] = ipDsGamePad.squareButton; + mapper[ds_d.Up] = ipDsGamePad.dpad.up; + mapper[ds_d.Down] = ipDsGamePad.dpad.down; + mapper[ds_d.Left] = ipDsGamePad.dpad.left; + mapper[ds_d.Right] = ipDsGamePad.dpad.right; + mapper[ds_d.L1] = ipDsGamePad.L1; + mapper[ds_d.L2] = ipDsGamePad.L2; + mapper[ds_d.L3] = ipDsGamePad.L3; + mapper[ds_d.R1] = ipDsGamePad.R1; + mapper[ds_d.R2] = ipDsGamePad.R2; + mapper[ds_d.R3] = ipDsGamePad.R3; + mapper[ds_d.Share] = ipDsGamePad.shareButton; + mapper[ds_d.Options] = ipDsGamePad.optionsButton; + mapper[ds_d.TouchpadBtn] = ipDsGamePad.touchpadButton; + mapper[ds_d.LeftStick] = ipDsGamePad.leftStick; + mapper[ds_d.RightStick] = ipDsGamePad.rightStick; + } + else if(device_d is XboxController_D xbox_d) + { + var ipXInputGamePad = ipdevice as XInputController; + mapper[xbox_d.X] = ipXInputGamePad.xButton; + mapper[xbox_d.Y] = ipXInputGamePad.yButton; + mapper[xbox_d.A] = ipXInputGamePad.aButton; + mapper[xbox_d.B] = ipXInputGamePad.bButton; + mapper[xbox_d.Up] = ipXInputGamePad.dpad.up; + mapper[xbox_d.Down] = ipXInputGamePad.dpad.down; + mapper[xbox_d.Left] = ipXInputGamePad.dpad.left; + mapper[xbox_d.Right] = ipXInputGamePad.dpad.right; + mapper[xbox_d.View] = ipXInputGamePad.view; + mapper[xbox_d.Menu] = ipXInputGamePad.menu; + mapper[xbox_d.LeftBumper] = ipXInputGamePad.leftShoulder; + mapper[xbox_d.LeftTrigger] = ipXInputGamePad.leftTrigger; + mapper[xbox_d.LeftStickPress] = ipXInputGamePad.leftStickButton; + mapper[xbox_d.RightBumper] = ipXInputGamePad.rightShoulder; + mapper[xbox_d.RightTrigger] = ipXInputGamePad.rightTrigger; + mapper[xbox_d.RightStickPress] = ipXInputGamePad.rightStickButton; + mapper[xbox_d.LeftStick] = ipXInputGamePad.leftStick; + mapper[xbox_d.RightStick] = ipXInputGamePad.rightStick; + + } else if (device_d is GamePad_D gamepad_d) { var ipGamepad = ipdevice as Gamepad;