Compare commits
3 Commits
8a415aa10f
...
7f621af33b
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f621af33b | |||
| 1a213108c6 | |||
| 9286c659c6 |
@ -29,6 +29,7 @@ namespace AxibugEmuOnline.Client.InputDevices
|
||||
|
||||
private void DefineControls()
|
||||
{
|
||||
//反射初始化所有控制对象 比如Button_C
|
||||
foreach (var field in GetType().GetFields(BindingFlags.Instance | BindingFlags.Public))
|
||||
{
|
||||
if (!typeof(InputControl_C).IsAssignableFrom(field.FieldType)) continue;
|
||||
|
||||
@ -30,6 +30,8 @@ namespace AxibugEmuOnline.Client.InputDevices
|
||||
public Button_C Right;
|
||||
public Button_C Down;
|
||||
public Button_C Left;
|
||||
public Button_C LeftBackTouch;
|
||||
public Button_C RightBackTouch;
|
||||
public Stick_C LeftStick;
|
||||
public Stick_C RightStick;
|
||||
|
||||
|
||||
@ -8,11 +8,11 @@
|
||||
#define JOYCON_SUPPORT
|
||||
#endif
|
||||
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.DualShock;
|
||||
using UnityEngine.InputSystem.Switch;
|
||||
using UnityEngine.InputSystem.XInput;
|
||||
|
||||
namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
||||
@ -31,6 +31,40 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
||||
|
||||
private void AddDevice(InputDevice ipdev)
|
||||
{
|
||||
string log = $"{ipdev.deviceId}| {ipdev.name}|{ipdev.displayName}|{ipdev.GetType().FullName}|{ipdev.GetType().BaseType.FullName}";
|
||||
|
||||
#if UNITY_ANDROID
|
||||
if (ipdev is Keyboard)
|
||||
{
|
||||
/*
|
||||
uinput-goodix:这很可能是指纹识别模块(Goodix 是一家常见的指纹传感器供应商)。
|
||||
gpio-keys:这是最典型的例子。GPIO Keys 直接指代通过通用输入输出引脚连接的物理按键,包括电源键和音量键。
|
||||
pmic_pwrkey:PMIC 是电源管理集成电路。这直接就是电源键的虚拟设备。
|
||||
pmic_resin:resin 可能指 resin key,在某些平台上这是强制重启的按键。
|
||||
pmic_pwrkey_resin_bark:可能与长按电源键+其他组合键实现的功能相关(如强制重启)。
|
||||
pineapple-mtp-snd-card Headset Jack:这指的是耳机插孔。插入和拔出耳机的事件,以及耳机上的线控按钮(如播放/暂停)也会被模拟为键盘事件。
|
||||
On-Screen Keyboard:这个是真正的屏幕软键盘。
|
||||
*/
|
||||
string deviceName = ipdev.displayName;
|
||||
if (deviceName.Contains("Virtual") ||
|
||||
deviceName.Contains("gpio-keys") ||//电源键
|
||||
deviceName.Contains("pmic") ||
|
||||
deviceName.Contains("goodix") ||
|
||||
deviceName.Contains("screen") ||
|
||||
deviceName.Contains("touch") ||
|
||||
deviceName.Contains("mtp-snd-card") ||
|
||||
deviceName.Contains("Headset Jack") ||//耳机线控
|
||||
deviceName.Contains("On-Screen") ||
|
||||
deviceName.Equals("AndroidInputManager")
|
||||
)
|
||||
{
|
||||
App.log.Debug($"过滤输入设备:{log}");
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
App.log.Debug($"加入输入设备:{log}");
|
||||
|
||||
InputDevice_D newDevice = null;
|
||||
if (ipdev is Keyboard) newDevice = new Keyboard_D(this);
|
||||
|
||||
@ -48,7 +82,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
||||
newDevice = new XboxController_D(this);
|
||||
}
|
||||
#if JOYCON_SUPPORT
|
||||
else if (ipdev is NPad)
|
||||
else if (ipdev is UnityEngine.InputSystem.Switch.NPad)
|
||||
{
|
||||
newDevice = new SwitchJoyCon_D(this);
|
||||
}
|
||||
@ -137,7 +171,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
||||
}
|
||||
}
|
||||
Dictionary<InputDevice_D, Dictionary<InputControl_C, InputControl>> m_deviceMapper = new Dictionary<InputDevice_D, Dictionary<InputControl_C, InputControl>>();
|
||||
void AddDeviceMapper(InputDevice_D device_d, InputDevice ipdevice)
|
||||
void AddDeviceMapper(InputDevice_D device_d, UnityEngine.InputSystem.InputDevice ipdevice)
|
||||
{
|
||||
m_deviceMapper.Add(device_d, new Dictionary<InputControl_C, InputControl>());
|
||||
var mapper = m_deviceMapper[device_d];
|
||||
@ -300,7 +334,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
||||
#if JOYCON_SUPPORT
|
||||
else if (device_d is SwitchJoyCon_D joycon_d)
|
||||
{
|
||||
var ipdevice_joycon = ipdevice as NPad;
|
||||
var ipdevice_joycon = ipdevice as UnityEngine.InputSystem.Switch.NPad;
|
||||
mapper[joycon_d.LeftSL] = ipdevice_joycon.leftSL;
|
||||
mapper[joycon_d.LeftSR] = ipdevice_joycon.leftSR;
|
||||
mapper[joycon_d.RightSL] = ipdevice_joycon.rightSL;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using AxiInputSP;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace AxibugEmuOnline.Client.InputDevices.ForPSV
|
||||
@ -48,6 +49,9 @@ namespace AxibugEmuOnline.Client.InputDevices.ForPSV
|
||||
else if (control == psvCon.Right) return Input.GetKey(KeyCode.Joystick1Button9);
|
||||
else if (control == psvCon.Down) return Input.GetKey(KeyCode.Joystick1Button10);
|
||||
else if (control == psvCon.Left) return Input.GetKey(KeyCode.Joystick1Button11);
|
||||
else if (control == psvCon.LeftBackTouch) return AxiPSVBackTouchEmuKey.GetKey(AxiPSVBackTouchType.LeftHalf);
|
||||
else if (control == psvCon.RightBackTouch) return AxiPSVBackTouchEmuKey.GetKey(AxiPSVBackTouchType.RigthHalf);
|
||||
|
||||
else if (control == psvCon.LeftStick || control == psvCon.RightStick)
|
||||
{
|
||||
var vec2 = control.GetVector2();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user