移植问题解决

This commit is contained in:
sin365 2024-12-26 00:30:59 +08:00
parent 64b9c02ef7
commit fca038e67d
4 changed files with 51 additions and 9 deletions

View File

@ -1,3 +1,4 @@
#if UNITY_EDITOR
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEditor; using UnityEditor;
@ -22,3 +23,4 @@ public class AxiPrefabCache_Com2GUID
public string ToGUID; public string ToGUID;
public MonoScript monoScript; public MonoScript monoScript;
} }
#endif

View File

@ -1,3 +1,4 @@
#if UNITY_EDITOR
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -5,7 +6,6 @@ using System.Linq;
using UnityEditor; using UnityEditor;
using UnityEditor.SceneManagement; using UnityEditor.SceneManagement;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement;
public class AxiProjectTools : EditorWindow public class AxiProjectTools : EditorWindow
{ {
@ -413,3 +413,4 @@ public class AxiProjectTools : EditorWindow
} }
} }
} }
#endif

View File

@ -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.Collections.Generic;
using System.Linq; using System.Linq;
using UnityEngine; using UnityEngine;
@ -190,6 +192,13 @@ namespace AxibugEmuOnline.Client
public static KeyListener GetKey(int controllerInput, EnumButtonType nesConBtnType) 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)) if (PlayerPrefs.HasKey(configKey))
{ {
return new KeyListener(PlayerPrefs.GetString(configKey)); return new KeyListener(PlayerPrefs.GetString(configKey));
@ -336,6 +345,38 @@ namespace AxibugEmuOnline.Client
return default(KeyListener); 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);
}
} }
} }
} }

View File

@ -212,12 +212,10 @@ namespace AxibugEmuOnline.Client
EditorUtility.SetDirty(db); EditorUtility.SetDirty(db);
AssetDatabase.SaveAssets(); AssetDatabase.SaveAssets();
} }
#endif
public IControllerSetuper GetControllerSetuper() public IControllerSetuper GetControllerSetuper()
{ {
return ControllerMapper; return ControllerMapper;
} }
#endif
} }
} }