过滤InputSystem安卓数十种虚拟键盘 | 调整NS宏管控位置影响其他平台编译
This commit is contained in:
parent
8a415aa10f
commit
9286c659c6
@ -8,11 +8,11 @@
|
|||||||
#define JOYCON_SUPPORT
|
#define JOYCON_SUPPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.InputSystem;
|
using UnityEngine.InputSystem;
|
||||||
using UnityEngine.InputSystem.DualShock;
|
using UnityEngine.InputSystem.DualShock;
|
||||||
using UnityEngine.InputSystem.Switch;
|
|
||||||
using UnityEngine.InputSystem.XInput;
|
using UnityEngine.InputSystem.XInput;
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
||||||
@ -31,6 +31,40 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
|||||||
|
|
||||||
private void AddDevice(InputDevice ipdev)
|
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;
|
InputDevice_D newDevice = null;
|
||||||
if (ipdev is Keyboard) newDevice = new Keyboard_D(this);
|
if (ipdev is Keyboard) newDevice = new Keyboard_D(this);
|
||||||
|
|
||||||
@ -48,7 +82,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
|||||||
newDevice = new XboxController_D(this);
|
newDevice = new XboxController_D(this);
|
||||||
}
|
}
|
||||||
#if JOYCON_SUPPORT
|
#if JOYCON_SUPPORT
|
||||||
else if (ipdev is NPad)
|
else if (ipdev is UnityEngine.InputSystem.Switch.NPad)
|
||||||
{
|
{
|
||||||
newDevice = new SwitchJoyCon_D(this);
|
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>>();
|
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>());
|
m_deviceMapper.Add(device_d, new Dictionary<InputControl_C, InputControl>());
|
||||||
var mapper = m_deviceMapper[device_d];
|
var mapper = m_deviceMapper[device_d];
|
||||||
@ -300,7 +334,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
|
|||||||
#if JOYCON_SUPPORT
|
#if JOYCON_SUPPORT
|
||||||
else if (device_d is SwitchJoyCon_D joycon_d)
|
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.LeftSL] = ipdevice_joycon.leftSL;
|
||||||
mapper[joycon_d.LeftSR] = ipdevice_joycon.leftSR;
|
mapper[joycon_d.LeftSR] = ipdevice_joycon.leftSR;
|
||||||
mapper[joycon_d.RightSL] = ipdevice_joycon.rightSL;
|
mapper[joycon_d.RightSL] = ipdevice_joycon.rightSL;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user