From 9286c659c6d7e859b2a29ce9b41da8a86d88882e Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Thu, 11 Sep 2025 15:55:04 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=87=E6=BB=A4InputSystem=E5=AE=89=E5=8D=93?= =?UTF-8?q?=E6=95=B0=E5=8D=81=E7=A7=8D=E8=99=9A=E6=8B=9F=E9=94=AE=E7=9B=98?= =?UTF-8?q?=20|=20=E8=B0=83=E6=95=B4NS=E5=AE=8F=E7=AE=A1=E6=8E=A7=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E5=BD=B1=E5=93=8D=E5=85=B6=E4=BB=96=E5=B9=B3=E5=8F=B0?= =?UTF-8?q?=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InputResolver/InputSystemResolver.cs | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) 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 15b9e85a..796221b0 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputSystemResolver.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/InputDevicesManager/InputResolver/InputSystemResolver.cs @@ -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> m_deviceMapper = new Dictionary>(); - 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()); 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;