diff --git a/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiPrefabCache.cs b/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiPrefabCache.cs index e6823ad..81aabc6 100644 --- a/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiPrefabCache.cs +++ b/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiPrefabCache.cs @@ -1,3 +1,4 @@ +#if UNITY_EDITOR using System; using System.Collections.Generic; using UnityEditor; @@ -21,4 +22,5 @@ public class AxiPrefabCache_Com2GUID public string ToPATH; public string ToGUID; public MonoScript monoScript; -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiProjectTools.cs b/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiProjectTools.cs index 73aa830..f531ce2 100644 --- a/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiProjectTools.cs +++ b/AxibugEmuOnline.Client/Assets/AxiProjectTools/Editors/AxiProjectTools.cs @@ -1,3 +1,4 @@ +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.IO; @@ -5,7 +6,6 @@ using System.Linq; using UnityEditor; using UnityEditor.SceneManagement; using UnityEngine; -using UnityEngine.SceneManagement; public class AxiProjectTools : EditorWindow { @@ -412,4 +412,5 @@ public class AxiProjectTools : EditorWindow textureImporter.SaveAndReimport(); } } -} \ No newline at end of file +} +#endif \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs index 6813d06..ec7024c 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs @@ -1,4 +1,6 @@ -using AxibugEmuOnline.Client.Event; +using AxibugEmuOnline.Client.ClientCore; +using AxibugEmuOnline.Client.Common; +using AxibugEmuOnline.Client.Event; using System.Collections.Generic; using System.Linq; using UnityEngine; @@ -189,7 +191,14 @@ namespace AxibugEmuOnline.Client public static KeyListener GetKey(int controllerInput, EnumButtonType nesConBtnType) { - string configKey = $"NES_{controllerInput}_{nesConBtnType}"; + string configKey = $"NES_{controllerInput}_{nesConBtnType}"; + + //PSV平台固定键值 + if (UnityEngine.Application.platform == RuntimePlatform.PSP2) + { + return KeyListener.GetPSVitaKey(controllerInput, nesConBtnType); + } + if (PlayerPrefs.HasKey(configKey)) { return new KeyListener(PlayerPrefs.GetString(configKey)); @@ -334,6 +343,38 @@ namespace AxibugEmuOnline.Client break; } + return default(KeyListener); + } + + + public static KeyListener GetPSVitaKey(int controllerIndex, EnumButtonType nesConBtnType) + { + switch (controllerIndex) + { + case 0: + switch (nesConBtnType) + { + case EnumButtonType.LEFT: + return new KeyListener(PSVitaKey.Left); + case EnumButtonType.RIGHT: + return new KeyListener(PSVitaKey.Right); + case EnumButtonType.UP: + return new KeyListener(PSVitaKey.Up); + case EnumButtonType.DOWN: + return new KeyListener(PSVitaKey.Down); + case EnumButtonType.START: + return new KeyListener(PSVitaKey.Start); + case EnumButtonType.SELECT: + return new KeyListener(PSVitaKey.Select); + case EnumButtonType.A: + return new KeyListener(PSVitaKey.Circle); + case EnumButtonType.B: + return new KeyListener(PSVitaKey.Cross); + case EnumButtonType.MIC: + return new KeyListener(PSVitaKey.Block); + } + break; + } return default(KeyListener); } } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs index 1b2c9f0..3230330 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesEmulator.cs @@ -212,12 +212,10 @@ namespace AxibugEmuOnline.Client EditorUtility.SetDirty(db); AssetDatabase.SaveAssets(); } - +#endif public IControllerSetuper GetControllerSetuper() { return ControllerMapper; - } - -#endif + } } } \ No newline at end of file