Merge pull request 'master' (#105) from Alienjack/AxibugEmuOnline:master into master

Reviewed-on: #105
This commit is contained in:
sin365 2025-08-19 13:35:27 +08:00
commit f275fa79c7
6 changed files with 237 additions and 56 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@ -0,0 +1,130 @@
fileFormatVersion: 2
guid: 562e8ae4167d26b42b4dd08d3f809531
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
using AxibugProtobuf;
using System.Collections;
using UnityEngine;
namespace AxibugEmuOnline.Client.InputDevices
{
public class SwitchJoyCon_D : InputDevice_D
{
public Button_C LeftSL;
public Button_C LeftSR;
public Button_C RightSL;
public Button_C RightSR;
public Button_C B;
public Button_C A;
public Button_C Y;
public Button_C X;
public Button_C Up;
public Button_C Down;
public Button_C Left;
public Button_C Right;
public Button_C Minus;
public Button_C Plus;
public Stick_C LeftStick;
public Stick_C RightStick;
public Button_C LeftStickPress;
public Button_C RightStickPress;
public SwitchJoyCon_D(InputResolver resolver) : base(resolver) { }
public override GamePadType PadType => GamePadType.SwitchJoyCon;
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 28380f06191bd35458b20113fbd2960b

View File

@ -1,8 +1,18 @@
#if ENABLE_INPUT_SYSTEM #if ENABLE_INPUT_SYSTEM
#if UNITY_EDITOR || UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN || UNITY_WSA || PACKAGE_DOCS_GENERATION
#define DUALSHOCK_SUPPORT
#endif
#if UNITY_EDITOR || UNITY_SWITCH || PACKAGE_DOCS_GENERATION
#define JOYCON_SUPPORT
#endif
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
@ -24,25 +34,25 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
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);
#if DUALSHOCK_SUPPORT
#if UNITY_STANDALONE || UNITY_PS5 || UNITY_PS4 || UNITY_PS3 //PC/Mac/Linux/PS345 才能用 DualShock
else if (ipdev is DualShockGamepad) else if (ipdev is DualShockGamepad)
{ {
if (ipdev is DualShock3GamepadHID) newDevice = new DualShockController_D(this, ps3: true); if (ipdev is DualShock3GamepadHID) newDevice = new DualShockController_D(this, ps3: true);
else if (ipdev is DualShock4GamepadHID) newDevice = new DualShockController_D(this, ps4: true); else if (ipdev is DualShock4GamepadHID) newDevice = new DualShockController_D(this, ps4: true);
else if (ipdev is DualSenseGamepadHID) newDevice = new DualShockController_D(this, ps5: true); else if (ipdev is DualSenseGamepadHID) newDevice = new DualShockController_D(this, ps5: true);
else newDevice = new DualShockController_D(this); else newDevice = new DualShockController_D(this);
} }
#endif #endif
#if UNITY_STANDALONE_WIN //仅Windows 才能用Xinput
else if (ipdev is XInputController) else if (ipdev is XInputController)
{ {
newDevice = new XboxController_D(this); newDevice = new XboxController_D(this);
} }
#if JOYCON_SUPPORT
else if (ipdev is NPad)
{
newDevice = new SwitchJoyCon_D(this);
}
#endif #endif
else if (ipdev is Gamepad) newDevice = new GamePad_D(this); //注意Gamepad的优先级,因为任何手柄,Inputsystem中的基类都是GamePad else if (ipdev is Gamepad) newDevice = new GamePad_D(this); //注意Gamepad的优先级,因为任何手柄,Inputsystem中的基类都是GamePad
if (newDevice != null) if (newDevice != null)
@ -240,6 +250,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
mapper[keyboard_d.Semicolon] = ipKeyboard.semicolonKey; mapper[keyboard_d.Semicolon] = ipKeyboard.semicolonKey;
mapper[keyboard_d.Quote] = ipKeyboard.quoteKey; mapper[keyboard_d.Quote] = ipKeyboard.quoteKey;
} }
#if DUALSHOCK_SUPPORT
else if (device_d is DualShockController_D ds_d) else if (device_d is DualShockController_D ds_d)
{ {
var ipDsGamePad = ipdevice as DualShockGamepad; var ipDsGamePad = ipdevice as DualShockGamepad;
@ -263,6 +274,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
mapper[ds_d.LeftStick] = ipDsGamePad.leftStick; mapper[ds_d.LeftStick] = ipDsGamePad.leftStick;
mapper[ds_d.RightStick] = ipDsGamePad.rightStick; mapper[ds_d.RightStick] = ipDsGamePad.rightStick;
} }
#endif
else if (device_d is XboxController_D xbox_d) else if (device_d is XboxController_D xbox_d)
{ {
var ipXInputGamePad = ipdevice as XInputController; var ipXInputGamePad = ipdevice as XInputController;
@ -284,53 +296,53 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
mapper[xbox_d.RightStickPress] = ipXInputGamePad.rightStickButton; mapper[xbox_d.RightStickPress] = ipXInputGamePad.rightStickButton;
mapper[xbox_d.LeftStick] = ipXInputGamePad.leftStick; mapper[xbox_d.LeftStick] = ipXInputGamePad.leftStick;
mapper[xbox_d.RightStick] = ipXInputGamePad.rightStick; mapper[xbox_d.RightStick] = ipXInputGamePad.rightStick;
} }
#if JOYCON_SUPPORT
else if (device_d is SwitchJoyCon_D joycon_d)
{
var ipdevice_joycon = ipdevice as NPad;
mapper[joycon_d.LeftSL] = ipdevice_joycon.leftSL;
mapper[joycon_d.LeftSR] = ipdevice_joycon.leftSR;
mapper[joycon_d.RightSL] = ipdevice_joycon.rightSL;
mapper[joycon_d.RightSR] = ipdevice_joycon.rightSR;
mapper[joycon_d.B] = ipdevice_joycon.bButton;
mapper[joycon_d.A] = ipdevice_joycon.aButton;
mapper[joycon_d.Y] = ipdevice_joycon.yButton;
mapper[joycon_d.X] = ipdevice_joycon.xButton;
mapper[joycon_d.Up] = ipdevice_joycon.dpad.up;
mapper[joycon_d.Down] = ipdevice_joycon.dpad.down;
mapper[joycon_d.Left] = ipdevice_joycon.dpad.left;
mapper[joycon_d.Right] = ipdevice_joycon.dpad.right;
mapper[joycon_d.Minus] = ipdevice_joycon.selectButton;
mapper[joycon_d.Plus] = ipdevice_joycon.startButton;
mapper[joycon_d.LeftStick] = ipdevice_joycon.leftStick;
mapper[joycon_d.RightStick] = ipdevice_joycon.rightStick;
mapper[joycon_d.RightStickPress] = ipdevice_joycon.rightStickButton;
mapper[joycon_d.LeftStickPress] = ipdevice_joycon.leftStickButton;
}
#endif
else if (device_d is GamePad_D gamepad_d) else if (device_d is GamePad_D gamepad_d)
{ {
if (ipdevice is UnityEngine.InputSystem.Switch.NPad ipdevice_ns) var ipGamepad = ipdevice as Gamepad;
{ mapper[gamepad_d.Up] = ipGamepad.dpad.up;
mapper[gamepad_d.Up] = ipdevice_ns.dpad.up; mapper[gamepad_d.Down] = ipGamepad.dpad.down;
mapper[gamepad_d.Down] = ipdevice_ns.dpad.down; mapper[gamepad_d.Left] = ipGamepad.dpad.left;
mapper[gamepad_d.Left] = ipdevice_ns.dpad.left; mapper[gamepad_d.Right] = ipGamepad.dpad.right;
mapper[gamepad_d.Right] = ipdevice_ns.dpad.right; mapper[gamepad_d.Select] = ipGamepad.selectButton;
mapper[gamepad_d.Select] = ipdevice_ns.selectButton; mapper[gamepad_d.Start] = ipGamepad.startButton;
mapper[gamepad_d.Start] = ipdevice_ns.startButton; mapper[gamepad_d.North] = ipGamepad.buttonNorth;
mapper[gamepad_d.North] = ipdevice_ns.xButton; mapper[gamepad_d.South] = ipGamepad.buttonSouth;
mapper[gamepad_d.South] = ipdevice_ns.bButton; mapper[gamepad_d.West] = ipGamepad.buttonWest;
mapper[gamepad_d.West] = ipdevice_ns.yButton; mapper[gamepad_d.East] = ipGamepad.buttonEast;
mapper[gamepad_d.East] = ipdevice_ns.aButton; mapper[gamepad_d.LeftShoulder] = ipGamepad.leftShoulder;
mapper[gamepad_d.LeftShoulder] = ipdevice_ns; mapper[gamepad_d.RightShoulder] = ipGamepad.rightShoulder;
mapper[gamepad_d.RightShoulder] = ipdevice_ns.rightShoulder; mapper[gamepad_d.LeftTrigger] = ipGamepad.leftTrigger;
mapper[gamepad_d.LeftTrigger] = ipdevice_ns.leftTrigger; mapper[gamepad_d.RightTrigger] = ipGamepad.rightTrigger;
mapper[gamepad_d.RightTrigger] = ipdevice_ns.rightTrigger; mapper[gamepad_d.LeftStickPress] = ipGamepad.leftStickButton;
mapper[gamepad_d.LeftStickPress] = ipdevice_ns.leftStickButton; mapper[gamepad_d.RightStickPress] = ipGamepad.rightStickButton;
mapper[gamepad_d.RightStickPress] = ipdevice_ns.rightStickButton; mapper[gamepad_d.LeftStick] = ipGamepad.leftStick;
mapper[gamepad_d.LeftStick] = ipdevice_ns.leftStick; mapper[gamepad_d.RightStick] = ipGamepad.rightStick;
mapper[gamepad_d.RightStick] = ipdevice_ns.rightStick;
}
else
{
var ipGamepad = ipdevice as Gamepad;
mapper[gamepad_d.Up] = ipGamepad.dpad.up;
mapper[gamepad_d.Down] = ipGamepad.dpad.down;
mapper[gamepad_d.Left] = ipGamepad.dpad.left;
mapper[gamepad_d.Right] = ipGamepad.dpad.right;
mapper[gamepad_d.Select] = ipGamepad.selectButton;
mapper[gamepad_d.Start] = ipGamepad.startButton;
mapper[gamepad_d.North] = ipGamepad.buttonNorth;
mapper[gamepad_d.South] = ipGamepad.buttonSouth;
mapper[gamepad_d.West] = ipGamepad.buttonWest;
mapper[gamepad_d.East] = ipGamepad.buttonEast;
mapper[gamepad_d.LeftShoulder] = ipGamepad.leftShoulder;
mapper[gamepad_d.RightShoulder] = ipGamepad.rightShoulder;
mapper[gamepad_d.LeftTrigger] = ipGamepad.leftTrigger;
mapper[gamepad_d.RightTrigger] = ipGamepad.rightTrigger;
mapper[gamepad_d.LeftStickPress] = ipGamepad.leftStickButton;
mapper[gamepad_d.RightStickPress] = ipGamepad.rightStickButton;
mapper[gamepad_d.LeftStick] = ipGamepad.leftStick;
mapper[gamepad_d.RightStick] = ipGamepad.rightStick;
}
} }
else throw new System.NotImplementedException($"初始化设备失败,未实现的物理按键映射 for {device_d.GetType()}"); else throw new System.NotImplementedException($"初始化设备失败,未实现的物理按键映射 for {device_d.GetType()}");
} }
@ -339,6 +351,6 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
m_deviceMapper.Remove(keyboard_d); m_deviceMapper.Remove(keyboard_d);
} }
} }
} }
#endif #endif

View File

@ -163,7 +163,7 @@ PlayerSettings:
androidMaxAspectRatio: 2.1 androidMaxAspectRatio: 2.1
androidMinAspectRatio: 1 androidMinAspectRatio: 1
applicationIdentifier: applicationIdentifier:
Android: com.DefaultCompany.AxibugEmuOnline.Client Android: com.AlienTechnology.AxibugEmuOnline.Client
Standalone: com.AlienTechnology.AxibugEmuOnline.Client Standalone: com.AlienTechnology.AxibugEmuOnline.Client
buildNumber: buildNumber:
Standalone: 0 Standalone: 0
@ -404,11 +404,13 @@ PlayerSettings:
iPhone: 1 iPhone: 1
tvOS: 1 tvOS: 1
m_BuildTargetGroupLightmapEncodingQuality: [] m_BuildTargetGroupLightmapEncodingQuality: []
m_BuildTargetGroupHDRCubemapEncodingQuality: []
m_BuildTargetGroupLightmapSettings: [] m_BuildTargetGroupLightmapSettings: []
m_BuildTargetGroupLoadStoreDebugModeSettings: [] m_BuildTargetGroupLoadStoreDebugModeSettings: []
m_BuildTargetNormalMapEncoding: [] m_BuildTargetNormalMapEncoding: []
m_BuildTargetDefaultTextureCompressionFormat: [] m_BuildTargetDefaultTextureCompressionFormat:
- serializedVersion: 3
m_BuildTarget: Android
m_Formats: 01000000
playModeTestRunnerEnabled: 0 playModeTestRunnerEnabled: 0
runPlayModeTestAsEditModeTest: 0 runPlayModeTestAsEditModeTest: 0
actionOnDotNetUnhandledException: 1 actionOnDotNetUnhandledException: 1
@ -668,12 +670,12 @@ PlayerSettings:
webGLMemoryLinearGrowthStep: 16 webGLMemoryLinearGrowthStep: 16
webGLMemoryGeometricGrowthStep: 0.2 webGLMemoryGeometricGrowthStep: 0.2
webGLMemoryGeometricGrowthCap: 96 webGLMemoryGeometricGrowthCap: 96
webGLEnableWebGPU: 0
webGLPowerPreference: 2 webGLPowerPreference: 2
webGLWebAssemblyTable: 0 webGLWebAssemblyTable: 0
webGLWebAssemblyBigInt: 0 webGLWebAssemblyBigInt: 0
webGLCloseOnQuit: 0 webGLCloseOnQuit: 0
webWasm2023: 0 webWasm2023: 0
webEnableSubmoduleStrippingCompatibility: 0
scriptingDefineSymbols: scriptingDefineSymbols:
Android: DOTWEEN;ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_EDITOR_ONLY;UNITY_POST_PROCESSING_STACK_V2 Android: DOTWEEN;ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_EDITOR_ONLY;UNITY_POST_PROCESSING_STACK_V2
EmbeddedLinux: UNITY_POST_PROCESSING_STACK_V2 EmbeddedLinux: UNITY_POST_PROCESSING_STACK_V2
@ -820,4 +822,3 @@ PlayerSettings:
insecureHttpOption: 2 insecureHttpOption: 2
androidVulkanDenyFilterList: [] androidVulkanDenyFilterList: []
androidVulkanAllowFilterList: [] androidVulkanAllowFilterList: []
androidVulkanDeviceFilterListAsset: {fileID: 0}