虚拟摇杆支持(包括XMB时)

This commit is contained in:
sin365 2025-03-07 13:28:35 +08:00
parent 6f9d77704e
commit b3b72440f5
36 changed files with 3889 additions and 52 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0a5208f1ea0c95b4fba6c793b1f7f3f7
guid: bd58e2a95e584a349912ae71b67764d9
folderAsset: yes
DefaultImporter:
externalObjects: {}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: edbd78fa6a0e1644ab34a5382e5bef52
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 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
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 64
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

View File

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 1b48676b7de98674194a8862f1962680
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 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
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,108 @@
fileFormatVersion: 2
guid: 96804c13c4960eb4e83ecb34ea269f4a
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 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
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -31,6 +31,7 @@ RectTransform:
m_Children:
- {fileID: 3531919738411886375}
- {fileID: 3531919739979819162}
- {fileID: 1479421568449666778}
- {fileID: 8368317206160511790}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -53,6 +54,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_InputUI: {fileID: 3531919739979819165}
m_OptionUI: {fileID: 3531919738411886374}
m_Joystick: {fileID: 1479421568449666778}
m_popTipsUI: {fileID: 5244143219655022973}
--- !u!1001 &286598211728911619
PrefabInstance:
@ -62,6 +64,38 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 3531919739338806919}
m_Modifications:
- target: {fileID: 5931284345598511, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5931284345598511, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5931284345598511, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5931284345598511, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5931284345598511, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5931284345598511, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5931284345598511, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5931284345598511, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3567888507220032771, guid: 838819c4b387d384c8f75f1919261c58, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@ -784,6 +818,112 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 4478785627166277610, guid: d3c2508a55398a24db5d68f68d2702ea, type: 3}
m_PrefabInstance: {fileID: 1091051462859282637}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &2731323643586367206
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 3531919739338806919}
m_Modifications:
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_AnchorMax.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770047, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_Name
value: ScreenKeyPad
objectReference: {fileID: 0}
- target: {fileID: 3557960760441770047, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
--- !u!224 &1479421568449666778 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
m_PrefabInstance: {fileID: 2731323643586367206}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &6972157500961473863
PrefabInstance:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: bb828a9e324f62649b40038f8cd3620a
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -34,6 +34,7 @@ namespace AxibugEmuOnline.Client.ClientCore
public static FileDownloader FileDownloader;
static bool bTest;
static string mTestSrvIP;
public static bool bUseGUIButton;
/// <summary> 收藏 Rom库 </summary>
@ -69,7 +70,7 @@ namespace AxibugEmuOnline.Client.ClientCore
return s_romLibs[platform];
}
public static void Init(bool isTest = false, string testSrvIP = "", bool bUseLocalWebApi = false, string mLocalWebApi = "")
public static void Init(bool isTest = false,bool isUseGUIButton = false, string testSrvIP = "", bool bUseLocalWebApi = false, string mLocalWebApi = "")
{
log = new LogManager(OnLogOut);
//其他平台必要的初始化
@ -105,6 +106,7 @@ namespace AxibugEmuOnline.Client.ClientCore
bTest = isTest;
bUseGUIButton = isUseGUIButton;
mTestSrvIP = testSrvIP;
var go = new GameObject("[AppAxibugEmuOnline]");
GameObject.DontDestroyOnLoad(go);

View File

@ -56,10 +56,10 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_3));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_4));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));

View File

@ -53,8 +53,8 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].ColletAllKey();
#endregion

View File

@ -53,8 +53,8 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].ColletAllKey();
#endregion

View File

@ -56,10 +56,10 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_3));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_4));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));

View File

@ -73,10 +73,10 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_3));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_4));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));

View File

@ -55,9 +55,9 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)EnumButtonType.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EnumButtonType.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EnumButtonType.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EnumButtonType.A, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)EnumButtonType.B, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)EnumButtonType.MIC, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_3));
controllers[0].SetKey((ulong)EnumButtonType.A, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EnumButtonType.B, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EnumButtonType.MIC, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
//P2 键盘
controllers[1].SetKey((ulong)EnumButtonType.START, AxiInputEx.ByKeyCode(KeyCode.Keypad0));

View File

@ -56,10 +56,10 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_3));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_4));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));

View File

@ -56,10 +56,10 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_3));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_4));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));

View File

@ -80,12 +80,12 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)UMAMEKSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)UMAMEKSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)UMAMEKSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_A, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_B, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_C, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_3));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_D, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_4));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_E, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_5));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_F, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_6));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_A, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_B, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_C, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_D, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_E, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_E));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_F, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_F));
controllers[0].ColletAllKey();
#endregion

View File

@ -51,8 +51,8 @@ namespace AxiInputSP.Setting
controllers[0].SetKey((ulong)EnumCommand.SelectItemDown, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EnumCommand.SelectItemLeft, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EnumCommand.SelectItemRight, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EnumCommand.Enter, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_1));
controllers[0].SetKey((ulong)EnumCommand.Back, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_2));
controllers[0].SetKey((ulong)EnumCommand.Enter, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EnumCommand.Back, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.HOME));
//PC XBOX

View File

@ -40,12 +40,12 @@ namespace AxiInputSP
DOWN,
LEFT,
RIGHT,
BTN_1,
BTN_2,
BTN_3,
BTN_4,
BTN_5,
BTN_6,
BTN_A,
BTN_B,
BTN_C,
BTN_D,
BTN_E,
BTN_F,
POTION_1,
POTION_2,
POTION_3,

View File

@ -16,7 +16,7 @@ namespace AxiInputSP.UGUI
{
dictHandle2AxiUgui[uiHandle.Handle] = uiHandle;
List<AxiInputUGUIHandle> list;
if (dictBtnType2BtnList.TryGetValue(uiHandle.UguiBtnType, out list))
if (!dictBtnType2BtnList.TryGetValue(uiHandle.UguiBtnType, out list))
list = dictBtnType2BtnList[uiHandle.UguiBtnType] = new List<AxiInputUGUIHandle>();
if (!list.Contains(uiHandle))

View File

@ -1,4 +1,5 @@
using UnityEngine.EventSystems;
using UnityEngine;
using UnityEngine.EventSystems;
namespace AxiInputSP.UGUI
{
@ -17,6 +18,7 @@ namespace AxiInputSP.UGUI
/// <summary>
/// 键值(支持组合键)
/// </summary>
[SerializeField]
public AxiInputUGuiBtnType[] axiBtnTypeList;
protected override void Awake()
{

View File

@ -0,0 +1,68 @@
using AxiInputSP.UGUI;
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
namespace AxibugEmuOnline.Editors
{
[CustomEditor(typeof(AxiIptButton))]
public class AxiIptButtonEditor : Editor
{
private ReorderableList _itemList;
private SerializedProperty _axiBtnTypeListProp;
private void OnEnable()
{
// 获取序列化属性
_axiBtnTypeListProp = serializedObject.FindProperty("axiBtnTypeList");
// 初始化 ReorderableList
_itemList = new ReorderableList(
serializedObject,
_axiBtnTypeListProp,
true, true, true, true
);
// 自定义列表绘制(保持原有逻辑)
_itemList.drawHeaderCallback = rect => GUI.Label(rect, "键位数组");
_itemList.drawElementCallback = (rect, index, active, focused) => {
var element = _axiBtnTypeListProp.GetArrayElementAtIndex(index);
EditorGUI.PropertyField(rect, element, GUIContent.none);
};
}
public override void OnInspectorGUI()
{
serializedObject.Update();
// 1. 优先绘制自定义的键位数组
EditorGUILayout.LabelField("自定义键位配置", EditorStyles.boldLabel);
_itemList.DoLayoutList();
// 2. 添加分割线
EditorGUILayout.Space(10);
GUILayout.Box("", GUILayout.Height(1), GUILayout.ExpandWidth(true));
EditorGUILayout.Space(5);
// 3. 绘制原生 Button 属性(排除已处理的 axiBtnTypeList
EditorGUILayout.LabelField("原生按钮属性", EditorStyles.boldLabel);
DrawDefaultInspectorExcluding("axiBtnTypeList");
serializedObject.ApplyModifiedProperties();
}
// 辅助方法:绘制排除指定字段的默认 Inspector
private void DrawDefaultInspectorExcluding(params string[] excludePaths)
{
var prop = serializedObject.GetIterator();
bool enterChildren = true;
while (prop.NextVisible(enterChildren))
{
enterChildren = false;
if (System.Array.IndexOf(excludePaths, prop.name) >= 0) continue;
EditorGUILayout.PropertyField(prop, true);
}
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 3d87eebb7dc59674db1165b853d18333

View File

@ -0,0 +1,121 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace AxiInputSP.UGUI
{
public class AxiIptJoystick : IDisposable
{
enum AxiIptJoystickState
{
None,
KeyUp,
KeyDown,
KeyHold
}
static long LastCheckFrame = -1;
static Func<Vector2Int> RawJoy;
AxiInputUGUIHandle[] handles = new AxiInputUGUIHandle[4];
static Dictionary<AxiInputUGuiBtnType, AxiIptJoystickState> mAxis2State = new Dictionary<AxiInputUGuiBtnType, AxiIptJoystickState>();
public AxiIptJoystick(Func<Vector2Int> getRawJoy)
{
RawJoy = getRawJoy;
handles[0] = new AxiInputUGUIHandle(AxiInputUGuiBtnType.UP);
handles[0].GetKeyHandle = (() => { return GetKey(AxiInputUGuiBtnType.UP); });
handles[0].GetKeyUpHandle = (() => { return GetKeyUp(AxiInputUGuiBtnType.UP); });
handles[0].GetKeyDownHandle = (() => { return GetKeyDown(AxiInputUGuiBtnType.UP); });
mAxis2State[AxiInputUGuiBtnType.UP] = AxiIptJoystickState.None;
handles[1] = new AxiInputUGUIHandle(AxiInputUGuiBtnType.DOWN);
handles[1].GetKeyHandle = (() => { return GetKey(AxiInputUGuiBtnType.DOWN); });
handles[1].GetKeyUpHandle = (() => { return GetKeyUp(AxiInputUGuiBtnType.DOWN); });
handles[1].GetKeyDownHandle = (() => { return GetKeyDown(AxiInputUGuiBtnType.DOWN); });
mAxis2State[AxiInputUGuiBtnType.DOWN] = AxiIptJoystickState.None;
handles[2] = new AxiInputUGUIHandle(AxiInputUGuiBtnType.LEFT);
handles[2].GetKeyHandle = (() => { return GetKey(AxiInputUGuiBtnType.LEFT); });
handles[2].GetKeyUpHandle = (() => { return GetKeyUp(AxiInputUGuiBtnType.LEFT); });
handles[2].GetKeyDownHandle = (() => { return GetKeyDown(AxiInputUGuiBtnType.LEFT); });
mAxis2State[AxiInputUGuiBtnType.LEFT] = AxiIptJoystickState.None;
handles[3] = new AxiInputUGUIHandle(AxiInputUGuiBtnType.RIGHT);
handles[3].GetKeyHandle = (() => { return GetKey(AxiInputUGuiBtnType.RIGHT); });
handles[3].GetKeyUpHandle = (() => { return GetKeyUp(AxiInputUGuiBtnType.RIGHT); });
handles[3].GetKeyDownHandle = (() => { return GetKeyDown(AxiInputUGuiBtnType.RIGHT); });
mAxis2State[AxiInputUGuiBtnType.RIGHT] = AxiIptJoystickState.None;
}
public void Dispose()
{
for (int i = 0; i < handles.Length; i++)
{
handles[i].Dispose();
handles[i] = null;
}
mAxis2State.Clear();
}
public static void UpdateState()
{
if (LastCheckFrame == Time.frameCount)
return;
LastCheckFrame = Time.frameCount;
RecheckSingleState(AxiInputUGuiBtnType.RIGHT);
RecheckSingleState(AxiInputUGuiBtnType.LEFT);
RecheckSingleState(AxiInputUGuiBtnType.UP);
RecheckSingleState(AxiInputUGuiBtnType.DOWN);
}
static void RecheckSingleState(AxiInputUGuiBtnType axisType)
{
bool bKey = false;
Vector2Int inputV2 = RawJoy.Invoke();
switch (axisType)
{
case AxiInputUGuiBtnType.RIGHT: bKey = inputV2.x > 0; break;
case AxiInputUGuiBtnType.LEFT: bKey = inputV2.x < 0; break;
case AxiInputUGuiBtnType.UP: bKey = inputV2.y > 0; break;
case AxiInputUGuiBtnType.DOWN: bKey = inputV2.y < 0; break;
}
//按下
if (bKey)
{
//如果之前帧是KeyUp或None则为KeyDown|KeyHold
if (mAxis2State[axisType] <= AxiIptJoystickState.KeyUp)
mAxis2State[axisType] = AxiIptJoystickState.KeyDown;
//如果之前帧是KeyDown则为KeyHold
else if (mAxis2State[axisType] == AxiIptJoystickState.KeyDown)
mAxis2State[axisType] = AxiIptJoystickState.KeyHold;
}
//未按下
else
{
//如果之前帧是KeyDown|KeyHold则为KeyUp|None
if (mAxis2State[axisType] >= AxiIptJoystickState.KeyDown)
mAxis2State[axisType] = AxiIptJoystickState.KeyUp;
//如果之前帧是KeyUp则为None
else if (mAxis2State[axisType] == AxiIptJoystickState.KeyUp)
mAxis2State[axisType] = AxiIptJoystickState.None;
}
}
bool GetKey(AxiInputUGuiBtnType key)
{
UpdateState();
return mAxis2State[key] >= AxiIptJoystickState.KeyDown;
}
bool GetKeyUp(AxiInputUGuiBtnType key)
{
UpdateState();
return mAxis2State[key] == AxiIptJoystickState.KeyUp;
}
bool GetKeyDown(AxiInputUGuiBtnType key)
{
UpdateState();
return mAxis2State[key] == AxiIptJoystickState.KeyDown;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 7194bc2da3bcaa747b87428fb3175009

View File

@ -23,12 +23,12 @@ namespace AxibugEmuOnline.Client
//config.numVirtualVoices = 512; // 设置虚拟音频源数量(可选)
//config.dspBufferSize = 1024; // 设置 DSP 缓冲区大小(可选)
//config.speakerMode = AudioSpeakerMode.Stereo; // 设置为立体声2 声道)
App.audioMgr.SetAudioConfig(new AudioConfiguration());
//App.audioMgr.SetAudioConfig(new AudioConfiguration());
//TODO 采样率需要更准确而且和clip并没有关系
//var dummy = AudioClip.Create("dummy", 1, 1, AudioSettings.outputSampleRate, false);
//dummy.SetData(new float[] { 1 }, 0);
//m_as.clip = dummy; //just to let unity play the audiosource
var dummy = AudioClip.Create("dummy", 1, 1, AudioSettings.outputSampleRate, false);
dummy.SetData(new float[] { 1 }, 0);
m_as.clip = dummy; //just to let unity play the audiosource
m_as.loop = true;
m_as.spatialBlend = 1;
m_as.Play();

View File

@ -22,19 +22,29 @@ namespace AxibugEmuOnline.Client
public bool bUseLocalWebApi = false;
public string mLocalWebApi = "http://localhost:5051";
public bool bEditorUUID = false;
public bool bEditorOpenGUIJoyStick = false;
#endif
private void Awake()
{
bool UseJoyStack = false;
if (Application.platform == RuntimePlatform.Android)
{
UseJoyStack = true;
}
#if UNITY_EDITOR
App.Init(bTestSkipWebApiToConServer, mTestSrvIP, bUseLocalWebApi, mLocalWebApi);
if (bEditorOpenGUIJoyStick)
UseJoyStack = true;
App.Init(bTestSkipWebApiToConServer, UseJoyStack, mTestSrvIP, bUseLocalWebApi, mLocalWebApi);
dev_UUID = SystemInfo.deviceUniqueIdentifier;
if (bEditorUUID)
{
dev_UUID += "_Editor";
}
#else
App.Init(this);
App.Init(false,UseJoyStack);
dev_UUID = SystemInfo.deviceUniqueIdentifier;
#endif

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d8f97c5606f773e4081e096d54eabe98
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,89 @@
using AxiInputSP.UGUI;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class FloatingJoystick : Joystick
{
public Image mImgBg;
public Image mImgHandle;
public Image mImgArrow;
public bool mIsMounseDown = false;
readonly static Color ShowColor = new Color(1F, 1f, 1F, 0.7f);
readonly static Color HideColor = new Color(1F, 1f, 1F, 0.3f);
AxiIptJoystick mAxiIptJoystick;
//一次新的摇杆移动
public static bool bNewTouchWithSkill = false;
protected override void Start()
{
base.Start();
mImgBg = background.transform.GetComponent<Image>();
mImgHandle = background.transform.Find("Handle").GetComponent<Image>();
mArrow = transform.Find("Background/Arrow").GetComponent<RectTransform>();
mImgArrow = transform.Find("Background/Arrow/imgArrow").GetComponent<Image>();
mArrow.gameObject.SetActive(false);
//background.gameObject.SetActive(false);
background.gameObject.SetActive(true);
background.transform.localPosition = new Vector3(256f, 256f, 0);
mImgBg.color = HideColor;
mImgHandle.color = HideColor;
mImgArrow.color = HideColor;
mIsMounseDown = false;
}
void OnEnable()
{
if (mAxiIptJoystick == null)
{
mAxiIptJoystick = new AxiIptJoystick(GetJoyRaw);
}
}
private void OnDisable()
{
if (mAxiIptJoystick != null)
{
mAxiIptJoystick.Dispose();
mAxiIptJoystick = null;
}
}
private Vector2Int GetJoyRaw()
{
return this.RawInputV2;
}
public override void OnPointerDown(PointerEventData eventData)
{
//background.anchoredPosition = ScreenPointToAnchoredPosition(eventData.position);
//background.gameObject.SetActive(true);
mImgBg.color = ShowColor;
mImgHandle.color = ShowColor;
mImgArrow.color = ShowColor;
mIsMounseDown = true;
base.OnPointerDown(eventData);
bNewTouchWithSkill = true;
}
public override void OnPointerUp(PointerEventData eventData)
{
//background.gameObject.SetActive(false);
PointerUp();
bNewTouchWithSkill = false;
}
public override void PointerUp()
{
if (background == null)
return;
background.transform.localPosition = new Vector3(256f, 256f, 0);
mImgBg.color = HideColor;
mImgHandle.color = HideColor;
mIsMounseDown = false;
base.PointerUp();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7a47f546fc70ec8428172694e78e4288
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,167 @@
using UnityEngine;
using UnityEngine.EventSystems;
public class Joystick : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler
{
public Vector2Int RawInputV2
{
get
{
return InputForEmu;
}
}
public float HandleRange
{
get { return handleRange; }
set { handleRange = Mathf.Abs(value); }
}
public float DeadZone
{
get { return deadZone; }
set { deadZone = Mathf.Abs(value); }
}
public AxisOptions AxisOptions { get { return AxisOptions; } set { axisOptions = value; } }
[SerializeField] private float handleRange = 1;
[SerializeField] private float deadZone = 0f;
[SerializeField] private AxisOptions axisOptions = AxisOptions.Both;
[SerializeField] private bool snapX = false;
[SerializeField] private bool snapY = false;
[SerializeField] protected RectTransform background = null;
[SerializeField] private RectTransform handle = null;
[SerializeField] protected RectTransform mArrow;
private RectTransform baseRect = null;
private Canvas canvas;
private Camera cam;
private Vector2 input = Vector2.zero;
public Vector2Int InputForEmu = Vector2Int.zero;
public static Joystick joystickInstance;
protected virtual void Start()
{
HandleRange = handleRange;
DeadZone = deadZone;
baseRect = GetComponent<RectTransform>();
canvas = GetComponentInParent<Canvas>();
if (canvas == null)
Debug.LogError("The Joystick is not placed inside a canvas");
else
{
if (cam == null)
{
if (canvas.renderMode == RenderMode.ScreenSpaceCamera)
cam = canvas.worldCamera;
}
}
Vector2 center = new Vector2(0.5f, 0.5f);
background.pivot = center;
handle.anchorMin = center;
handle.anchorMax = center;
handle.pivot = center;
handle.anchoredPosition = Vector2.zero;
joystickInstance = this;
}
public virtual void OnPointerDown(PointerEventData eventData)
{
OnDrag(eventData);
}
Vector2 mArrowTop = new Vector2(0,1);
public void OnDrag(PointerEventData eventData)
{
if (cam == null)
{
if (canvas.renderMode == RenderMode.ScreenSpaceCamera)
cam = canvas.worldCamera;
}
Vector2 position = RectTransformUtility.WorldToScreenPoint(cam, background.position);
Vector2 radius = background.sizeDelta / 2;
input = (eventData.position - position) / (radius * canvas.scaleFactor);
//FormatInput();
HandleInput(input.magnitude, input.normalized, radius, cam);
handle.anchoredPosition = input * radius * handleRange;
}
protected virtual void HandleInput(float magnitude, Vector2 normalised, Vector2 radius, Camera cam)
{
if (magnitude > deadZone)
{
if (magnitude > 1)
{
input = normalised;
}
}
else
{
input = Vector2.zero;
}
if (magnitude > deadZone && input != Vector2.zero)
{
if (!mArrow.gameObject.activeSelf) mArrow.gameObject.SetActive(true);
float angle = Vector2.Angle(mArrowTop, input.normalized);
if (input.x > 0)
angle *= -1;
mArrow.rotation = Quaternion.Euler(0, 0, angle);
}
else
if (mArrow.gameObject.activeSelf) mArrow.gameObject.SetActive(false);
if (input.x < -1 * deadZone)
InputForEmu.x = -1;
else if (input.x > deadZone)
InputForEmu.x = 1;
else
InputForEmu.x = 0;
if (input.y < -1 * deadZone)
InputForEmu.y = -1;
else if (input.y > deadZone)
InputForEmu.y = 1;
else
InputForEmu.y = 0;
}
public virtual void OnPointerUp(PointerEventData eventData)
{
PointerUp();
}
public virtual void PointerUp()
{
input = Vector2.zero;
InputForEmu = Vector2Int.zero;
handle.anchoredPosition = Vector2.zero;
mArrow.gameObject.SetActive(false);
}
protected Vector2 ScreenPointToAnchoredPosition(Vector2 screenPosition)
{
Vector2 localPoint = Vector2.zero;
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(baseRect, screenPosition, cam, out localPoint))
{
Vector2 pivotOffset = baseRect.pivot * baseRect.sizeDelta;
return localPoint - (background.anchorMax * baseRect.sizeDelta) + pivotOffset;
}
return Vector2.zero;
}
}
public enum AxisOptions { Both, Horizontal, Vertical }

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b9fca4100a7477741b3973b4ff2c405f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +1,5 @@
using System;
using AxibugEmuOnline.Client.ClientCore;
using System;
using System.Collections.Generic;
using UnityEngine;
@ -11,6 +12,7 @@ namespace AxibugEmuOnline.Client
[SerializeField] InputUI m_InputUI;
[SerializeField] OptionUI m_OptionUI;
[SerializeField] Transform m_Joystick;
[SerializeField] PopTipsUI m_popTipsUI;
private void Awake()
@ -18,6 +20,8 @@ namespace AxibugEmuOnline.Client
s_ins = this;
m_InputUI.gameObject.SetActive(false);
m_Joystick.gameObject.SetActive(App.bUseGUIButton);
}
public static void Input(Action<string> callback, string placeHolder, string defaultText)