From def785b3a3b4ff60d12716b291c29654f5a93ed1 Mon Sep 17 00:00:00 2001 From: sin365 <353374337@qq.com> Date: Mon, 23 Sep 2024 13:21:51 +0800 Subject: [PATCH] PSVitaKey --- .../Assets/Script/Common/PSVitaKey.cs | 32 +++++++++++++ .../Assets/Script/Common/PSVitaKey.cs.meta | 11 +++++ .../UI/CommandDispatcher/CommandDispatcher.cs | 46 +++++++++++++------ 3 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs create mode 100644 AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs.meta diff --git a/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs b/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs new file mode 100644 index 0000000..a402121 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs @@ -0,0 +1,32 @@ +using UnityEngine; + +namespace AxibugEmuOnline.Client.Common +{ + public static class PSVitaKey + { + /// + /// × + /// + public static KeyCode Cross => KeyCode.Joystick1Button0; + /// + /// â­• + /// + public static KeyCode Circle => KeyCode.Joystick1Button1; + /// + /// â–¡ + /// + public static KeyCode Block => KeyCode.Joystick1Button2; + /// + /// 🔺 + /// + public static KeyCode Triangle => KeyCode.Joystick1Button3; + public static KeyCode L => KeyCode.Joystick1Button4; + public static KeyCode R => KeyCode.Joystick1Button5; + public static KeyCode Select => KeyCode.Joystick1Button6; + public static KeyCode Start => KeyCode.Joystick1Button7; + public static KeyCode Up => KeyCode.Joystick1Button8; + public static KeyCode Right => KeyCode.Joystick1Button9; + public static KeyCode Down => KeyCode.Joystick1Button10; + public static KeyCode Left => KeyCode.Joystick1Button11 + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs.meta b/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs.meta new file mode 100644 index 0000000..a4f1fe5 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 71934f91b4b95184a966ac2b316bfddf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs index 487a421..ddb7155 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs @@ -18,22 +18,38 @@ namespace AxibugEmuOnline.Client { Instance = this; - m_keyMapper.Add(KeyCode.A, EnumCommand.SelectItemLeft); - m_keyMapper.Add(KeyCode.D, EnumCommand.SelectItemRight); - m_keyMapper.Add(KeyCode.W, EnumCommand.SelectItemUp); - m_keyMapper.Add(KeyCode.S, EnumCommand.SelectItemDown); - m_keyMapper.Add(KeyCode.K, EnumCommand.Enter); - m_keyMapper.Add(KeyCode.L, EnumCommand.Back); - m_keyMapper.Add(KeyCode.I, EnumCommand.OptionMenu); + m_keyMapper[KeyCode.A] = EnumCommand.SelectItemLeft; + m_keyMapper[KeyCode.D] = EnumCommand.SelectItemRight; + m_keyMapper[KeyCode.W] = EnumCommand.SelectItemUp; + m_keyMapper[KeyCode.S] = EnumCommand.SelectItemDown; + m_keyMapper[KeyCode.K] = EnumCommand.Enter; + m_keyMapper[KeyCode.L] = EnumCommand.Back; + m_keyMapper[KeyCode.I] = EnumCommand.OptionMenu; + m_keyMapper[KeyCode.LeftArrow] = EnumCommand.SelectItemLeft; + m_keyMapper[KeyCode.RightArrow] = EnumCommand.SelectItemRight; + m_keyMapper[KeyCode.UpArrow] = EnumCommand.SelectItemUp; + m_keyMapper[KeyCode.DownArrow] = EnumCommand.SelectItemDown; + m_keyMapper[KeyCode.Return] = EnumCommand.Enter; + m_keyMapper[KeyCode.Escape] = EnumCommand.Back; + m_keyMapper[KeyCode.RightShift] = EnumCommand.OptionMenu; + m_keyMapper[KeyCode.LeftShift] = EnumCommand.OptionMenu; - m_keyMapper.Add(KeyCode.LeftArrow, EnumCommand.SelectItemLeft); - m_keyMapper.Add(KeyCode.RightArrow, EnumCommand.SelectItemRight); - m_keyMapper.Add(KeyCode.UpArrow, EnumCommand.SelectItemUp); - m_keyMapper.Add(KeyCode.DownArrow, EnumCommand.SelectItemDown); - m_keyMapper.Add(KeyCode.Return, EnumCommand.Enter); - m_keyMapper.Add(KeyCode.Escape, EnumCommand.Back); - m_keyMapper.Add(KeyCode.RightShift, EnumCommand.OptionMenu); - m_keyMapper.Add(KeyCode.LeftShift, EnumCommand.OptionMenu); + + if (Application.platform == RuntimePlatform.PSP2) + { + m_keyMapper[Common.PSVitaKey.Left] = EnumCommand.SelectItemLeft; + m_keyMapper[Common.PSVitaKey.Right] = EnumCommand.SelectItemRight; + m_keyMapper[Common.PSVitaKey.Up] = EnumCommand.SelectItemUp; + m_keyMapper[Common.PSVitaKey.Down] = EnumCommand.SelectItemDown; + m_keyMapper[Common.PSVitaKey.Circle] = EnumCommand.Enter; + m_keyMapper[Common.PSVitaKey.Cross] = EnumCommand.Back; + m_keyMapper[Common.PSVitaKey.Triangle] = EnumCommand.OptionMenu; + } + //ÊÖ±ú + else + { + + } } private void OnDestroy()