过滤InputSystem安卓数十种虚拟键盘 | 调整NS宏管控位置影响其他平台编译

This commit is contained in:
sin365 2025-09-11 15:55:04 +08:00
parent 8a415aa10f
commit 9286c659c6

View File

@ -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-goodixGoodix
gpio-keysGPIO Keys
pmic_pwrkeyPMIC
pmic_resinresin 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;