将所有抽象层Input的类加上后缀,D代表设备,C代表控件,避免和InputSystem中的设备重名
This commit is contained in:
parent
8007af0bc5
commit
50e3a30f31
AxibugEmuOnline.Client/Assets/Script/AppMain/Manager
AppSettings/KeyMapperSetting
InputDevicesManager
@ -22,9 +22,9 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
|
|
||||||
public abstract class EssgeeKeyBinding : EmuCoreControllerKeyBinding<EssgeeSingleKey>
|
public abstract class EssgeeKeyBinding : EmuCoreControllerKeyBinding<EssgeeSingleKey>
|
||||||
{
|
{
|
||||||
protected override void OnRegistDevices(InputDevice device, BindingPage binding)
|
protected override void OnRegistDevices(InputDevice_D device, BindingPage binding)
|
||||||
{
|
{
|
||||||
if (device is KeyBoard keyboard)
|
if (device is Keyboard_D keyboard)
|
||||||
{
|
{
|
||||||
switch (binding.ControllerIndex)
|
switch (binding.ControllerIndex)
|
||||||
{
|
{
|
||||||
@ -54,7 +54,7 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (device is PSVController psvCon && binding.ControllerIndex == 0)
|
else if (device is PSVController_D psvCon && binding.ControllerIndex == 0)
|
||||||
{
|
{
|
||||||
binding.SetBinding(EssgeeSingleKey.OPTION_1, psvCon.Start, 0);
|
binding.SetBinding(EssgeeSingleKey.OPTION_1, psvCon.Start, 0);
|
||||||
binding.SetBinding(EssgeeSingleKey.OPTION_2, psvCon.Select, 0);
|
binding.SetBinding(EssgeeSingleKey.OPTION_2, psvCon.Select, 0);
|
||||||
@ -98,9 +98,9 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
public override RomPlatformType Platform => RomPlatformType.GameBoyColor;
|
public override RomPlatformType Platform => RomPlatformType.GameBoyColor;
|
||||||
public override int ControllerCount => 1;
|
public override int ControllerCount => 1;
|
||||||
|
|
||||||
protected override void OnRegistDevices(InputDevice device, BindingPage binding)
|
protected override void OnRegistDevices(InputDevice_D device, BindingPage binding)
|
||||||
{
|
{
|
||||||
if (device is KeyBoard keyboard)
|
if (device is Keyboard_D keyboard)
|
||||||
{
|
{
|
||||||
switch (binding.ControllerIndex)
|
switch (binding.ControllerIndex)
|
||||||
{
|
{
|
||||||
@ -125,9 +125,9 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
public override RomPlatformType Platform => RomPlatformType.GameBoy;
|
public override RomPlatformType Platform => RomPlatformType.GameBoy;
|
||||||
public override int ControllerCount => 1;
|
public override int ControllerCount => 1;
|
||||||
|
|
||||||
protected override void OnRegistDevices(InputDevice device, BindingPage binding)
|
protected override void OnRegistDevices(InputDevice_D device, BindingPage binding)
|
||||||
{
|
{
|
||||||
if (device is KeyBoard keyboard)
|
if (device is Keyboard_D keyboard)
|
||||||
{
|
{
|
||||||
switch (binding.ControllerIndex)
|
switch (binding.ControllerIndex)
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
m_bindingPages.Add(new BindingPage(i, this));
|
m_bindingPages.Add(new BindingPage(i, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
var keyboard = App.input.GetDevice<KeyBoard>();
|
var keyboard = App.input.GetDevice<Keyboard_D>();
|
||||||
if (keyboard != null)
|
if (keyboard != null)
|
||||||
{
|
{
|
||||||
foreach (var binding in m_bindingPages)
|
foreach (var binding in m_bindingPages)
|
||||||
@ -79,7 +79,7 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var psvController = App.input.GetDevice<PSVController>();
|
var psvController = App.input.GetDevice<PSVController_D>();
|
||||||
if (psvController != null)
|
if (psvController != null)
|
||||||
{
|
{
|
||||||
foreach (var binding in m_bindingPages)
|
foreach (var binding in m_bindingPages)
|
||||||
@ -92,9 +92,9 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
App.input.OnDeviceConnected += InputDevicesMgr_OnDeviceConnected;
|
App.input.OnDeviceConnected += InputDevicesMgr_OnDeviceConnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InputDevicesMgr_OnDeviceConnected(InputDevice connectDevice)
|
private void InputDevicesMgr_OnDeviceConnected(InputDevice_D connectDevice)
|
||||||
{
|
{
|
||||||
if (connectDevice is KeyBoard)
|
if (connectDevice is Keyboard_D)
|
||||||
{
|
{
|
||||||
foreach (var binding in m_bindingPages)
|
foreach (var binding in m_bindingPages)
|
||||||
{
|
{
|
||||||
@ -103,15 +103,15 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InputDevicesMgr_OnDeviceLost(InputDevice lostDevice)
|
private void InputDevicesMgr_OnDeviceLost(InputDevice_D lostDevice)
|
||||||
{
|
{
|
||||||
foreach (var binding in m_bindingPages)
|
foreach (var binding in m_bindingPages)
|
||||||
{
|
{
|
||||||
binding.UnregistInputDevice(lostDevice);
|
binding.UnregistInputDevice(lostDevice);
|
||||||
}
|
}
|
||||||
if (lostDevice is KeyBoard) //键盘丢失,立即查找还存在的键盘并建立连接
|
if (lostDevice is Keyboard_D) //键盘丢失,立即查找还存在的键盘并建立连接
|
||||||
{
|
{
|
||||||
var anotherKeyboard = App.input.GetDevice<KeyBoard>();
|
var anotherKeyboard = App.input.GetDevice<Keyboard_D>();
|
||||||
if (anotherKeyboard != null)
|
if (anotherKeyboard != null)
|
||||||
{
|
{
|
||||||
foreach (var binding in m_bindingPages)
|
foreach (var binding in m_bindingPages)
|
||||||
@ -127,11 +127,11 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
return Enum.GetValues(typeof(T)).Cast<T>();
|
return Enum.GetValues(typeof(T)).Cast<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void RaiseDeviceRegist(InputDevice device, BindingPage binding)
|
internal void RaiseDeviceRegist(InputDevice_D device, BindingPage binding)
|
||||||
{
|
{
|
||||||
OnRegistDevices(device, binding);
|
OnRegistDevices(device, binding);
|
||||||
}
|
}
|
||||||
protected abstract void OnRegistDevices(InputDevice device, BindingPage binding);
|
protected abstract void OnRegistDevices(InputDevice_D device, BindingPage binding);
|
||||||
|
|
||||||
public bool Start(T emuControl, int controllerIndex)
|
public bool Start(T emuControl, int controllerIndex)
|
||||||
{
|
{
|
||||||
@ -232,12 +232,12 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
else return totalFloat / totalControl;
|
else return totalFloat / totalControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MapSetting : Dictionary<T, List<InputControl>> { }
|
public class MapSetting : Dictionary<T, List<InputControl_D>> { }
|
||||||
|
|
||||||
public class BindingPage
|
public class BindingPage
|
||||||
{
|
{
|
||||||
Dictionary<Type, InputDevice> m_registedDevices = new Dictionary<Type, InputDevice>();
|
Dictionary<Type, InputDevice_D> m_registedDevices = new Dictionary<Type, InputDevice_D>();
|
||||||
Dictionary<InputDevice, MapSetting> m_mapSetting = new Dictionary<InputDevice, MapSetting>();
|
Dictionary<InputDevice_D, MapSetting> m_mapSetting = new Dictionary<InputDevice_D, MapSetting>();
|
||||||
|
|
||||||
public int ControllerIndex { get; }
|
public int ControllerIndex { get; }
|
||||||
public EmuCoreControllerKeyBinding<T> Host { get; }
|
public EmuCoreControllerKeyBinding<T> Host { get; }
|
||||||
@ -248,7 +248,7 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
Host = host;
|
Host = host;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool IsRegisted<DEVICE>() where DEVICE : InputDevice
|
internal bool IsRegisted<DEVICE>() where DEVICE : InputDevice_D
|
||||||
{
|
{
|
||||||
var type = typeof(T);
|
var type = typeof(T);
|
||||||
return IsRegisted(type);
|
return IsRegisted(type);
|
||||||
@ -258,7 +258,7 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
return m_registedDevices.ContainsKey(deviceType);
|
return m_registedDevices.ContainsKey(deviceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void RegistInputDevice(InputDevice device)
|
internal void RegistInputDevice(InputDevice_D device)
|
||||||
{
|
{
|
||||||
var type = device.GetType();
|
var type = device.GetType();
|
||||||
if (IsRegisted(type)) return;
|
if (IsRegisted(type)) return;
|
||||||
@ -268,7 +268,7 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
Host.RaiseDeviceRegist(device, this);
|
Host.RaiseDeviceRegist(device, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void UnregistInputDevice(InputDevice device)
|
internal void UnregistInputDevice(InputDevice_D device)
|
||||||
{
|
{
|
||||||
var type = device.GetType();
|
var type = device.GetType();
|
||||||
if (!IsRegisted(type)) return;
|
if (!IsRegisted(type)) return;
|
||||||
@ -277,7 +277,7 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
m_mapSetting.Remove(device);
|
m_mapSetting.Remove(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBinding(T emuBtn, InputControl key, int settingSlot)
|
public void SetBinding(T emuBtn, InputControl_D key, int settingSlot)
|
||||||
{
|
{
|
||||||
var device = key.Device;
|
var device = key.Device;
|
||||||
m_registedDevices.TryGetValue(device.GetType(), out var inputDevice);
|
m_registedDevices.TryGetValue(device.GetType(), out var inputDevice);
|
||||||
@ -287,7 +287,7 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
var setting = m_mapSetting[inputDevice];
|
var setting = m_mapSetting[inputDevice];
|
||||||
if (!setting.TryGetValue(emuBtn, out var settingList))
|
if (!setting.TryGetValue(emuBtn, out var settingList))
|
||||||
{
|
{
|
||||||
settingList = new List<InputControl>();
|
settingList = new List<InputControl_D>();
|
||||||
setting[emuBtn] = settingList;
|
setting[emuBtn] = settingList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -297,7 +297,7 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
settingList[settingSlot] = key;
|
settingList[settingSlot] = key;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputControl GetBinding(T emuBtn, InputDevice device, int settingSlot)
|
public InputControl_D GetBinding(T emuBtn, InputDevice_D device, int settingSlot)
|
||||||
{
|
{
|
||||||
m_mapSetting.TryGetValue(device, out var mapSetting);
|
m_mapSetting.TryGetValue(device, out var mapSetting);
|
||||||
if (mapSetting == null) return null;
|
if (mapSetting == null) return null;
|
||||||
@ -308,8 +308,8 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
return settingList[settingSlot];
|
return settingList[settingSlot];
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<InputControl> m_caches = new List<InputControl>();
|
private List<InputControl_D> m_caches = new List<InputControl_D>();
|
||||||
public IEnumerable<InputControl> GetBinding(T emuBtn)
|
public IEnumerable<InputControl_D> GetBinding(T emuBtn)
|
||||||
{
|
{
|
||||||
m_caches.Clear();
|
m_caches.Clear();
|
||||||
|
|
||||||
|
@ -23,9 +23,9 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
{
|
{
|
||||||
public override int ControllerCount => 4;
|
public override int ControllerCount => 4;
|
||||||
|
|
||||||
protected override void OnRegistDevices(InputDevice device, BindingPage binding)
|
protected override void OnRegistDevices(InputDevice_D device, BindingPage binding)
|
||||||
{
|
{
|
||||||
if (device is KeyBoard keyboard)
|
if (device is Keyboard_D keyboard)
|
||||||
{
|
{
|
||||||
switch (binding.ControllerIndex)
|
switch (binding.ControllerIndex)
|
||||||
{
|
{
|
||||||
|
@ -9,9 +9,9 @@ namespace AxibugEmuOnline.Client.Settings
|
|||||||
public override RomPlatformType Platform => RomPlatformType.Nes;
|
public override RomPlatformType Platform => RomPlatformType.Nes;
|
||||||
public override int ControllerCount => 4;
|
public override int ControllerCount => 4;
|
||||||
|
|
||||||
protected override void OnRegistDevices(InputDevice device, BindingPage binding)
|
protected override void OnRegistDevices(InputDevice_D device, BindingPage binding)
|
||||||
{
|
{
|
||||||
if (device is KeyBoard keyboard)
|
if (device is Keyboard_D keyboard)
|
||||||
{
|
{
|
||||||
switch (binding.ControllerIndex)
|
switch (binding.ControllerIndex)
|
||||||
{
|
{
|
||||||
|
@ -9,9 +9,9 @@ namespace AxibugEmuOnline.Client
|
|||||||
public override RomPlatformType Platform => RomPlatformType.Invalid;
|
public override RomPlatformType Platform => RomPlatformType.Invalid;
|
||||||
public override int ControllerCount => 2;
|
public override int ControllerCount => 2;
|
||||||
|
|
||||||
protected override void OnRegistDevices(InputDevice device, BindingPage binding)
|
protected override void OnRegistDevices(InputDevice_D device, BindingPage binding)
|
||||||
{
|
{
|
||||||
if (device is KeyBoard keyboard)
|
if (device is Keyboard_D keyboard)
|
||||||
{
|
{
|
||||||
switch (binding.ControllerIndex)
|
switch (binding.ControllerIndex)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,34 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AxibugEmuOnline.Client.InputDevices
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 通用游戏控制器
|
||||||
|
/// </summary>
|
||||||
|
public class GamePad_D : InputDevice_D
|
||||||
|
{
|
||||||
|
public Button_C Up { get; private set; }
|
||||||
|
public Button_C Down { get; private set; }
|
||||||
|
public Button_C Left { get; private set; }
|
||||||
|
public Button_C Right { get; private set; }
|
||||||
|
public Button_C Option { get; private set; }
|
||||||
|
public Button_C Start { get; private set; }
|
||||||
|
public Button_C North { get; private set; }
|
||||||
|
public Button_C South { get; private set; }
|
||||||
|
public Button_C West { get; private set; }
|
||||||
|
public Button_C East { get; private set; }
|
||||||
|
public Button_C LeftShoulder { get; private set; }
|
||||||
|
public Button_C RightShoulder { get; private set; }
|
||||||
|
public Button_C LeftTrigger { get; private set; }
|
||||||
|
public Button_C RightTrigger { get; private set; }
|
||||||
|
|
||||||
|
public GamePad_D(InputResolver resolver) : base(resolver) { }
|
||||||
|
|
||||||
|
protected override List<InputControl_D> DefineControls()
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: adda9a9ea56de5742bc1b00ce85ce9e5
|
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e098c1dc313c2d746b3a0c6a7f1a69f0
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
@ -3,11 +3,11 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 按键类型的输入控件
|
/// 按键类型的输入控件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Button : InputControl
|
public class Button_C : InputControl_D
|
||||||
{
|
{
|
||||||
string m_controlName;
|
string m_controlName;
|
||||||
|
|
||||||
public Button(InputDevice device, string controlName) : base(device)
|
public Button_C(InputDevice_D device, string controlName) : base(device)
|
||||||
{
|
{
|
||||||
m_controlName = controlName;
|
m_controlName = controlName;
|
||||||
}
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 2106c0f7afa9b7647978373d7c6d5aae
|
@ -5,10 +5,10 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 输入设备的抽象控件接口
|
/// 输入设备的抽象控件接口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class InputControl
|
public abstract class InputControl_D
|
||||||
{
|
{
|
||||||
/// <summary> 控件所属设备 </summary>
|
/// <summary> 控件所属设备 </summary>
|
||||||
public InputDevice Device { get; internal set; }
|
public InputDevice_D Device { get; internal set; }
|
||||||
|
|
||||||
/// <summary> 获取该控件是否在当前调用帧被激发 </summary>
|
/// <summary> 获取该控件是否在当前调用帧被激发 </summary>
|
||||||
public bool Start { get; private set; }
|
public bool Start { get; private set; }
|
||||||
@ -51,7 +51,7 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
/// <summary> 控件名,这个控件名称必须是唯一的 </summary>
|
/// <summary> 控件名,这个控件名称必须是唯一的 </summary>
|
||||||
public abstract string ControlName { get; }
|
public abstract string ControlName { get; }
|
||||||
|
|
||||||
internal InputControl(InputDevice device)
|
internal InputControl_D(InputDevice_D device)
|
||||||
{
|
{
|
||||||
Device = device;
|
Device = device;
|
||||||
}
|
}
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0d3d88a49545f614184e3d5a59d2958e
|
@ -5,7 +5,7 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 摇杆类型的输入控件,支持的返回值为Vector2
|
/// 摇杆类型的输入控件,支持的返回值为Vector2
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Stick : InputControl
|
public class Stick_C : InputControl_D
|
||||||
{
|
{
|
||||||
string m_controlName;
|
string m_controlName;
|
||||||
public override string ControlName => m_controlName;
|
public override string ControlName => m_controlName;
|
||||||
@ -15,7 +15,7 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
public VirtualButton Left { get; private set; }
|
public VirtualButton Left { get; private set; }
|
||||||
public VirtualButton Right { get; private set; }
|
public VirtualButton Right { get; private set; }
|
||||||
|
|
||||||
public Stick(InputDevice device, string controlName) : base(device)
|
public Stick_C(InputDevice_D device, string controlName) : base(device)
|
||||||
{
|
{
|
||||||
m_controlName = controlName;
|
m_controlName = controlName;
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class VirtualButton : InputControl
|
public class VirtualButton : InputControl_D
|
||||||
{
|
{
|
||||||
internal bool m_performing;
|
internal bool m_performing;
|
||||||
|
|
||||||
public VirtualButton(InputDevice device) : base(device) { }
|
public VirtualButton(InputDevice_D device) : base(device) { }
|
||||||
|
|
||||||
public override bool Performing
|
public override bool Performing
|
||||||
{
|
{
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9091f3794f770294488695cd2cbbf7af
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace AxibugEmuOnline.Client.InputDevices
|
namespace AxibugEmuOnline.Client.InputDevices
|
||||||
{
|
{
|
||||||
public abstract class InputDevice
|
public abstract class InputDevice_D
|
||||||
{
|
{
|
||||||
public string UniqueName => m_resolver.GetDeviceName(this);
|
public string UniqueName => m_resolver.GetDeviceName(this);
|
||||||
|
|
||||||
@ -13,9 +13,9 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
/// <summary> 获得输入解决器 </summary>
|
/// <summary> 获得输入解决器 </summary>
|
||||||
internal InputResolver Resolver => m_resolver;
|
internal InputResolver Resolver => m_resolver;
|
||||||
|
|
||||||
protected Dictionary<string, InputControl> m_controlMapper = new Dictionary<string, InputControl>();
|
protected Dictionary<string, InputControl_D> m_controlMapper = new Dictionary<string, InputControl_D>();
|
||||||
protected InputResolver m_resolver;
|
protected InputResolver m_resolver;
|
||||||
public InputDevice(InputResolver resolver)
|
public InputDevice_D(InputResolver resolver)
|
||||||
{
|
{
|
||||||
m_resolver = resolver;
|
m_resolver = resolver;
|
||||||
|
|
||||||
@ -41,12 +41,12 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
|
|
||||||
/// <summary> 用于列出这个输入设备的所有输入控件实例 </summary>
|
/// <summary> 用于列出这个输入设备的所有输入控件实例 </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected abstract List<InputControl> DefineControls();
|
protected abstract List<InputControl_D> DefineControls();
|
||||||
|
|
||||||
/// <summary> 通过控件名称,找到对应的控件 </summary>
|
/// <summary> 通过控件名称,找到对应的控件 </summary>
|
||||||
/// <param name="keyName"></param>
|
/// <param name="keyName"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public InputControl FindControlByName(string controlName)
|
public InputControl_D FindControlByName(string controlName)
|
||||||
{
|
{
|
||||||
m_controlMapper.TryGetValue(controlName, out var key);
|
m_controlMapper.TryGetValue(controlName, out var key);
|
||||||
return key;
|
return key;
|
@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: eab247826950d024b8a5c7ade4142391
|
@ -7,15 +7,15 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通用键盘设备
|
/// 通用键盘设备
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class KeyBoard : InputDevice
|
public partial class Keyboard_D : InputDevice_D
|
||||||
{
|
{
|
||||||
Dictionary<KeyCode, KeyboardKey> m_keyControllerMap = new Dictionary<KeyCode, KeyboardKey>();
|
Dictionary<KeyCode, KeyboardKey> m_keyControllerMap = new Dictionary<KeyCode, KeyboardKey>();
|
||||||
|
|
||||||
public KeyBoard(InputResolver resolver) : base(resolver) { }
|
public Keyboard_D(InputResolver resolver) : base(resolver) { }
|
||||||
|
|
||||||
protected override List<InputControl> DefineControls()
|
protected override List<InputControl_D> DefineControls()
|
||||||
{
|
{
|
||||||
var keys = s_keyboardKeys.Select(kc => new KeyboardKey(kc, this) as InputControl).ToList();
|
var keys = s_keyboardKeys.Select(kc => new KeyboardKey(kc, this) as InputControl_D).ToList();
|
||||||
foreach (KeyboardKey key in keys)
|
foreach (KeyboardKey key in keys)
|
||||||
{
|
{
|
||||||
m_keyControllerMap.Add(key.m_keycode, key);
|
m_keyControllerMap.Add(key.m_keycode, key);
|
||||||
@ -23,11 +23,11 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
return keys;
|
return keys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class KeyboardKey : Button
|
public class KeyboardKey : Button_C
|
||||||
{
|
{
|
||||||
internal KeyCode m_keycode;
|
internal KeyCode m_keycode;
|
||||||
|
|
||||||
internal KeyboardKey(KeyCode listenKey, KeyBoard keyboard)
|
internal KeyboardKey(KeyCode listenKey, Keyboard_D keyboard)
|
||||||
: base(keyboard, listenKey.ToString())
|
: base(keyboard, listenKey.ToString())
|
||||||
{
|
{
|
||||||
m_keycode = listenKey;
|
m_keycode = listenKey;
|
||||||
@ -36,7 +36,7 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
}
|
}
|
||||||
|
|
||||||
#region HardCodeForKeyboard
|
#region HardCodeForKeyboard
|
||||||
public partial class KeyBoard : InputDevice
|
public partial class Keyboard_D : InputDevice_D
|
||||||
{
|
{
|
||||||
static readonly List<KeyCode> s_keyboardKeys = new List<KeyCode>
|
static readonly List<KeyCode> s_keyboardKeys = new List<KeyCode>
|
||||||
{
|
{
|
@ -1,54 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client.InputDevices
|
|
||||||
{
|
|
||||||
public class PSVController : InputDevice
|
|
||||||
{
|
|
||||||
/// <summary> × </summary>
|
|
||||||
public Button Cross { get; private set; }
|
|
||||||
/// <summary> ○ </summary>
|
|
||||||
public Button Circle { get; private set; }
|
|
||||||
/// <summary> □ </summary>
|
|
||||||
public Button Square { get; private set; }
|
|
||||||
/// <summary> △ </summary>
|
|
||||||
public Button Triangle { get; private set; }
|
|
||||||
public Button L { get; private set; }
|
|
||||||
public Button R { get; private set; }
|
|
||||||
public Button Select { get; private set; }
|
|
||||||
public Button Start { get; private set; }
|
|
||||||
public Button Up { get; private set; }
|
|
||||||
public Button Right { get; private set; }
|
|
||||||
public Button Down { get; private set; }
|
|
||||||
public Button Left { get; private set; }
|
|
||||||
public Stick LeftStick { get; private set; }
|
|
||||||
public Stick RightStick { get; private set; }
|
|
||||||
|
|
||||||
public PSVController(InputResolver resolver) : base(resolver) { }
|
|
||||||
|
|
||||||
protected override List<InputControl> DefineControls()
|
|
||||||
{
|
|
||||||
List<InputControl> result = new List<InputControl>();
|
|
||||||
|
|
||||||
Cross = new Button(this, "X");
|
|
||||||
Circle = new Button(this, "⭕");
|
|
||||||
Square = new Button(this, "□");
|
|
||||||
Triangle = new Button(this, "△");
|
|
||||||
|
|
||||||
L = new Button(this, "L");
|
|
||||||
R = new Button(this, "R");
|
|
||||||
|
|
||||||
Select = new Button(this, "SELECT");
|
|
||||||
Start = new Button(this, "START");
|
|
||||||
|
|
||||||
Up = new Button(this, "UP");
|
|
||||||
Right = new Button(this, "RIGHT");
|
|
||||||
Down = new Button(this, "DOWN");
|
|
||||||
Left = new Button(this, "LEFT");
|
|
||||||
|
|
||||||
LeftStick = new Stick(this, nameof(LeftStick));
|
|
||||||
RightStick = new Stick(this, nameof(RightStick));
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,54 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace AxibugEmuOnline.Client.InputDevices
|
||||||
|
{
|
||||||
|
public class PSVController_D : InputDevice_D
|
||||||
|
{
|
||||||
|
/// <summary> × </summary>
|
||||||
|
public Button_C Cross { get; private set; }
|
||||||
|
/// <summary> ○ </summary>
|
||||||
|
public Button_C Circle { get; private set; }
|
||||||
|
/// <summary> □ </summary>
|
||||||
|
public Button_C Square { get; private set; }
|
||||||
|
/// <summary> △ </summary>
|
||||||
|
public Button_C Triangle { get; private set; }
|
||||||
|
public Button_C L { get; private set; }
|
||||||
|
public Button_C R { get; private set; }
|
||||||
|
public Button_C Select { get; private set; }
|
||||||
|
public Button_C Start { get; private set; }
|
||||||
|
public Button_C Up { get; private set; }
|
||||||
|
public Button_C Right { get; private set; }
|
||||||
|
public Button_C Down { get; private set; }
|
||||||
|
public Button_C Left { get; private set; }
|
||||||
|
public Stick_C LeftStick { get; private set; }
|
||||||
|
public Stick_C RightStick { get; private set; }
|
||||||
|
|
||||||
|
public PSVController_D(InputResolver resolver) : base(resolver) { }
|
||||||
|
|
||||||
|
protected override List<InputControl_D> DefineControls()
|
||||||
|
{
|
||||||
|
List<InputControl_D> result = new List<InputControl_D>();
|
||||||
|
|
||||||
|
Cross = new Button_C(this, "X");
|
||||||
|
Circle = new Button_C(this, "⭕");
|
||||||
|
Square = new Button_C(this, "□");
|
||||||
|
Triangle = new Button_C(this, "△");
|
||||||
|
|
||||||
|
L = new Button_C(this, "L");
|
||||||
|
R = new Button_C(this, "R");
|
||||||
|
|
||||||
|
Select = new Button_C(this, "SELECT");
|
||||||
|
Start = new Button_C(this, "START");
|
||||||
|
|
||||||
|
Up = new Button_C(this, "UP");
|
||||||
|
Right = new Button_C(this, "RIGHT");
|
||||||
|
Down = new Button_C(this, "DOWN");
|
||||||
|
Left = new Button_C(this, "LEFT");
|
||||||
|
|
||||||
|
LeftStick = new Stick_C(this, nameof(LeftStick));
|
||||||
|
RightStick = new Stick_C(this, nameof(RightStick));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -6,11 +6,11 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
public class InputDevicesManager
|
public class InputDevicesManager
|
||||||
{
|
{
|
||||||
InputResolver m_inputResolver = InputResolver.Create();
|
InputResolver m_inputResolver = InputResolver.Create();
|
||||||
Dictionary<string, InputDevice> m_devices = new Dictionary<string, InputDevice>();
|
Dictionary<string, InputDevice_D> m_devices = new Dictionary<string, InputDevice_D>();
|
||||||
|
|
||||||
public delegate void OnDeviceConnectedHandle(InputDevice connectDevice);
|
public delegate void OnDeviceConnectedHandle(InputDevice_D connectDevice);
|
||||||
public event OnDeviceConnectedHandle OnDeviceConnected;
|
public event OnDeviceConnectedHandle OnDeviceConnected;
|
||||||
public delegate void OnDeviceLostHandle(InputDevice lostDevice);
|
public delegate void OnDeviceLostHandle(InputDevice_D lostDevice);
|
||||||
public event OnDeviceLostHandle OnDeviceLost;
|
public event OnDeviceLostHandle OnDeviceLost;
|
||||||
|
|
||||||
public InputDevicesManager()
|
public InputDevicesManager()
|
||||||
@ -21,23 +21,23 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
AddDevice(device);
|
AddDevice(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Resolver_OnDeviceLost(InputDevice lostDevice)
|
private void Resolver_OnDeviceLost(InputDevice_D lostDevice)
|
||||||
{
|
{
|
||||||
RemoveDevice(lostDevice);
|
RemoveDevice(lostDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Resolver_OnDeviceConnected(InputDevice connectDevice)
|
private void Resolver_OnDeviceConnected(InputDevice_D connectDevice)
|
||||||
{
|
{
|
||||||
AddDevice(connectDevice);
|
AddDevice(connectDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddDevice(InputDevice device)
|
void AddDevice(InputDevice_D device)
|
||||||
{
|
{
|
||||||
m_devices[device.UniqueName] = device;
|
m_devices[device.UniqueName] = device;
|
||||||
OnDeviceConnected?.Invoke(device);
|
OnDeviceConnected?.Invoke(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveDevice(InputDevice device)
|
void RemoveDevice(InputDevice_D device)
|
||||||
{
|
{
|
||||||
m_devices.Remove(device.UniqueName);
|
m_devices.Remove(device.UniqueName);
|
||||||
OnDeviceLost?.Invoke(device);
|
OnDeviceLost?.Invoke(device);
|
||||||
@ -46,7 +46,7 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得一个指定类型的设备
|
/// 获得一个指定类型的设备
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public T GetDevice<T>() where T : InputDevice
|
public T GetDevice<T>() where T : InputDevice_D
|
||||||
{
|
{
|
||||||
foreach (var d in m_devices.Values)
|
foreach (var d in m_devices.Values)
|
||||||
{
|
{
|
||||||
|
@ -30,40 +30,40 @@ namespace AxibugEmuOnline.Client.InputDevices
|
|||||||
/// 获得所有当前已连入的输入设备
|
/// 获得所有当前已连入的输入设备
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public abstract IEnumerable<InputDevice> GetDevices();
|
public abstract IEnumerable<InputDevice_D> GetDevices();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 检查指定输入设备是否还保持着连接
|
/// 检查指定输入设备是否还保持着连接
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public abstract bool CheckOnline(InputDevice device);
|
public abstract bool CheckOnline(InputDevice_D device);
|
||||||
|
|
||||||
/// <param name="lostDevice">丢失的设备</param>
|
/// <param name="lostDevice">丢失的设备</param>
|
||||||
public delegate void OnDeviceLostHandle(InputDevice lostDevice);
|
public delegate void OnDeviceLostHandle(InputDevice_D lostDevice);
|
||||||
/// <summary> 当设备丢失时触发 </summary>
|
/// <summary> 当设备丢失时触发 </summary>
|
||||||
public event OnDeviceLostHandle OnDeviceLost;
|
public event OnDeviceLostHandle OnDeviceLost;
|
||||||
protected void RaiseDeviceLost(InputDevice lostDevice)
|
protected void RaiseDeviceLost(InputDevice_D lostDevice)
|
||||||
{
|
{
|
||||||
OnDeviceLost?.Invoke(lostDevice);
|
OnDeviceLost?.Invoke(lostDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <param name="connectDevice">建立连接的设备</param>
|
/// <param name="connectDevice">建立连接的设备</param>
|
||||||
public delegate void OnDeviceConnectedHandle(InputDevice connectDevice);
|
public delegate void OnDeviceConnectedHandle(InputDevice_D connectDevice);
|
||||||
/// <summary> 当设备连接时触发 </summary>
|
/// <summary> 当设备连接时触发 </summary>
|
||||||
public event OnDeviceConnectedHandle OnDeviceConnected;
|
public event OnDeviceConnectedHandle OnDeviceConnected;
|
||||||
protected void RaiseDeviceConnected(InputDevice connectDevice)
|
protected void RaiseDeviceConnected(InputDevice_D connectDevice)
|
||||||
{
|
{
|
||||||
OnDeviceConnected?.Invoke(connectDevice);
|
OnDeviceConnected?.Invoke(connectDevice);
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract bool CheckPerforming<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl;
|
public abstract bool CheckPerforming<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_D;
|
||||||
public abstract Vector2 GetVector2<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl;
|
public abstract Vector2 GetVector2<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_D;
|
||||||
public abstract float GetFloat<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl;
|
public abstract float GetFloat<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_D;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得输入设备的唯一名称
|
/// 获得输入设备的唯一名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputDevice">这个设备必须是由resolver提供,并且保持着连接</param>
|
/// <param name="inputDevice">这个设备必须是由resolver提供,并且保持着连接</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public abstract string GetDeviceName(InputDevice inputDevice);
|
public abstract string GetDeviceName(InputDevice_D inputDevice);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,30 +1,27 @@
|
|||||||
#if ENABLE_INPUT_SYSTEM
|
#if ENABLE_INPUT_SYSTEM
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
using UnityEngine.InputSystem.Controls;
|
using UnityEngine.InputSystem.Controls;
|
||||||
using IP = UnityEngine.InputSystem.InputSystem;
|
|
||||||
using IPDevice = UnityEngine.InputSystem.InputDevice;
|
|
||||||
using IPKeyboard = UnityEngine.InputSystem.Keyboard;
|
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
||||||
{
|
{
|
||||||
/// <summary> 基于UnityInputSystem实现的输入解决器 </summary>
|
/// <summary> 基于UnityInputSystem实现的输入解决器 </summary>
|
||||||
public class InputSystemResolver : InputResolver
|
public class InputSystemResolver : InputResolver
|
||||||
{
|
{
|
||||||
DualWayDictionary<IPDevice, InputDevice> m_devices = new DualWayDictionary<IPDevice, InputDevice>();
|
DualWayDictionary<InputDevice, InputDevice_D> m_devices = new DualWayDictionary<InputDevice, InputDevice_D>();
|
||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
foreach (var device in IP.devices) AddDevice(device);
|
foreach (var device in InputSystem.devices) AddDevice(device);
|
||||||
|
|
||||||
IP.onDeviceChange += IP_onDeviceChange;
|
InputSystem.onDeviceChange += IP_onDeviceChange;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddDevice(IPDevice ipdev)
|
private void AddDevice(InputDevice ipdev)
|
||||||
{
|
{
|
||||||
InputDevice newDevice = null;
|
InputDevice_D newDevice = null;
|
||||||
if (ipdev is IPKeyboard) newDevice = new KeyBoard(this);
|
if (ipdev is Keyboard) newDevice = new Keyboard_D(this);
|
||||||
|
|
||||||
if (newDevice != null)
|
if (newDevice != null)
|
||||||
{
|
{
|
||||||
m_devices.Add(ipdev, newDevice);
|
m_devices.Add(ipdev, newDevice);
|
||||||
@ -32,7 +29,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveDevice(IPDevice ipdev)
|
private void RemoveDevice(InputDevice ipdev)
|
||||||
{
|
{
|
||||||
if (m_devices.TryGetValue(ipdev, out var device))
|
if (m_devices.TryGetValue(ipdev, out var device))
|
||||||
{
|
{
|
||||||
@ -41,7 +38,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetDeviceName(InputDevice inputDevice)
|
public override string GetDeviceName(InputDevice_D inputDevice)
|
||||||
{
|
{
|
||||||
m_devices.TryGetKey(inputDevice, out var ipdev);
|
m_devices.TryGetKey(inputDevice, out var ipdev);
|
||||||
Debug.Assert(ipdev != null, "不能对已离线的设备获取名称");
|
Debug.Assert(ipdev != null, "不能对已离线的设备获取名称");
|
||||||
@ -49,12 +46,12 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
|||||||
return $"{ipdev.description.deviceClass}_{ipdev.description.interfaceName}_{ipdev.deviceId}";
|
return $"{ipdev.description.deviceClass}_{ipdev.description.interfaceName}_{ipdev.deviceId}";
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckOnline(InputDevice device)
|
public override bool CheckOnline(InputDevice_D device)
|
||||||
{
|
{
|
||||||
return m_devices.TryGetKey(device, out var _);
|
return m_devices.TryGetKey(device, out var _);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IP_onDeviceChange(IPDevice device, UnityEngine.InputSystem.InputDeviceChange changeType)
|
private void IP_onDeviceChange(InputDevice device, UnityEngine.InputSystem.InputDeviceChange changeType)
|
||||||
{
|
{
|
||||||
switch (changeType)
|
switch (changeType)
|
||||||
{
|
{
|
||||||
@ -63,20 +60,20 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<InputDevice> GetDevices()
|
public override IEnumerable<InputDevice_D> GetDevices()
|
||||||
{
|
{
|
||||||
return m_devices.Values;
|
return m_devices.Values;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckPerforming<CONTROLLER>(CONTROLLER control)
|
public override bool CheckPerforming<CONTROLLER>(CONTROLLER control)
|
||||||
{
|
{
|
||||||
if (control.Device is KeyBoard keyboard)
|
if (control.Device is Keyboard_D keyboard)
|
||||||
{
|
{
|
||||||
if (control is KeyBoard.KeyboardKey key)
|
if (control is Keyboard_D.KeyboardKey key)
|
||||||
{
|
{
|
||||||
if (m_devices.TryGetKey(keyboard, out var ipdev))
|
if (m_devices.TryGetKey(keyboard, out var ipdev))
|
||||||
{
|
{
|
||||||
var ipKeyboard = ipdev as IPKeyboard;
|
var ipKeyboard = ipdev as Keyboard;
|
||||||
if (ipKeyboard == null) return false;
|
if (ipKeyboard == null) return false;
|
||||||
|
|
||||||
var k = GetIPKeyboardKey(ipKeyboard, key.m_keycode);
|
var k = GetIPKeyboardKey(ipKeyboard, key.m_keycode);
|
||||||
@ -101,7 +98,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
|||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
static ButtonControl GetIPKeyboardKey(IPKeyboard keyboard, KeyCode key)
|
static ButtonControl GetIPKeyboardKey(Keyboard keyboard, KeyCode key)
|
||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
|
@ -6,35 +6,35 @@ namespace AxibugEmuOnline.Client.InputDevices.ForPSV
|
|||||||
/// <summary> PSV特化输入解决器,只能用于PSV平台,并且只支持PSV控制器 </summary>
|
/// <summary> PSV特化输入解决器,只能用于PSV平台,并且只支持PSV控制器 </summary>
|
||||||
public class PSVResolver : InputResolver
|
public class PSVResolver : InputResolver
|
||||||
{
|
{
|
||||||
List<InputDevice> m_devices = new List<InputDevice>();
|
List<InputDevice_D> m_devices = new List<InputDevice_D>();
|
||||||
PSVController m_psvController;
|
PSVController_D m_psvController;
|
||||||
|
|
||||||
protected override void OnInit()
|
protected override void OnInit()
|
||||||
{
|
{
|
||||||
m_psvController = new PSVController(this);
|
m_psvController = new PSVController_D(this);
|
||||||
m_devices.Add(m_psvController);
|
m_devices.Add(m_psvController);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<InputDevice> GetDevices()
|
public override IEnumerable<InputDevice_D> GetDevices()
|
||||||
{
|
{
|
||||||
return m_devices;
|
return m_devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckOnline(InputDevice device)
|
public override bool CheckOnline(InputDevice_D device)
|
||||||
{
|
{
|
||||||
return device == m_psvController;
|
return device == m_psvController;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string GetDeviceName(InputDevice inputDevice)
|
public override string GetDeviceName(InputDevice_D inputDevice)
|
||||||
{
|
{
|
||||||
Debug.Assert(inputDevice == m_psvController, "只支持psv控制器");
|
Debug.Assert(inputDevice == m_psvController, "只支持psv控制器");
|
||||||
|
|
||||||
return nameof(PSVController);
|
return nameof(PSVController_D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CheckPerforming<CONTROLLER>(CONTROLLER control)
|
public override bool CheckPerforming<CONTROLLER>(CONTROLLER control)
|
||||||
{
|
{
|
||||||
if (control.Device is PSVController psvCon)
|
if (control.Device is PSVController_D psvCon)
|
||||||
{
|
{
|
||||||
if (control == psvCon.Cross) return Input.GetKey(KeyCode.Joystick1Button0);
|
if (control == psvCon.Cross) return Input.GetKey(KeyCode.Joystick1Button0);
|
||||||
else if (control == psvCon.Circle) return Input.GetKey(KeyCode.Joystick1Button1);
|
else if (control == psvCon.Circle) return Input.GetKey(KeyCode.Joystick1Button1);
|
||||||
@ -60,7 +60,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForPSV
|
|||||||
|
|
||||||
public override Vector2 GetVector2<CONTROLLER>(CONTROLLER control)
|
public override Vector2 GetVector2<CONTROLLER>(CONTROLLER control)
|
||||||
{
|
{
|
||||||
if (control.Device is PSVController psvCon)
|
if (control.Device is PSVController_D psvCon)
|
||||||
{
|
{
|
||||||
if (control == psvCon.LeftStick)
|
if (control == psvCon.LeftStick)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user