diff --git a/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs b/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs index a402121..fd86bb2 100644 --- a/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs +++ b/AxibugEmuOnline.Client/Assets/Script/Common/PSVitaKey.cs @@ -27,6 +27,6 @@ namespace AxibugEmuOnline.Client.Common public static KeyCode Up => KeyCode.Joystick1Button8; public static KeyCode Right => KeyCode.Joystick1Button9; public static KeyCode Down => KeyCode.Joystick1Button10; - public static KeyCode Left => KeyCode.Joystick1Button11 + public static KeyCode Left => KeyCode.Joystick1Button11; } } diff --git a/AxibugEmuOnline.Client/Assets/Script/ControlSchemes/ControlScheme.cs b/AxibugEmuOnline.Client/Assets/Script/ControlSchemes/ControlScheme.cs index 50d5e43..30b57d0 100644 --- a/AxibugEmuOnline.Client/Assets/Script/ControlSchemes/ControlScheme.cs +++ b/AxibugEmuOnline.Client/Assets/Script/ControlSchemes/ControlScheme.cs @@ -13,7 +13,9 @@ namespace AxibugEmuOnline.Client { m_current = value; - m_current.SetUIKeys(CommandDispatcher.Instance.GetKeyMapper()); + Dictionary mapper = new Dictionary(); + m_current.SetUIKeys(mapper); + CommandDispatcher.Instance.SetKeyMapper(mapper); } } @@ -21,8 +23,6 @@ namespace AxibugEmuOnline.Client public virtual void SetUIKeys(Dictionary uiKeyMapper) { - uiKeyMapper.Clear(); - uiKeyMapper[KeyCode.A] = EnumCommand.SelectItemLeft; uiKeyMapper[KeyCode.D] = EnumCommand.SelectItemRight; uiKeyMapper[KeyCode.W] = EnumCommand.SelectItemUp; @@ -39,6 +39,17 @@ namespace AxibugEmuOnline.Client uiKeyMapper[KeyCode.Escape] = EnumCommand.Back; uiKeyMapper[KeyCode.RightShift] = EnumCommand.OptionMenu; uiKeyMapper[KeyCode.LeftShift] = EnumCommand.OptionMenu; + + if (Application.platform == RuntimePlatform.PSP2) + { + uiKeyMapper[Common.PSVitaKey.Left] = EnumCommand.SelectItemLeft; + uiKeyMapper[Common.PSVitaKey.Right] = EnumCommand.SelectItemRight; + uiKeyMapper[Common.PSVitaKey.Up] = EnumCommand.SelectItemUp; + uiKeyMapper[Common.PSVitaKey.Down] = EnumCommand.SelectItemDown; + uiKeyMapper[Common.PSVitaKey.Circle] = EnumCommand.Enter; + uiKeyMapper[Common.PSVitaKey.Cross] = EnumCommand.Back; + uiKeyMapper[Common.PSVitaKey.Triangle] = EnumCommand.OptionMenu; + } } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/ControlSchemes/NesGamingScheme.cs b/AxibugEmuOnline.Client/Assets/Script/ControlSchemes/NesGamingScheme.cs index 6336b35..3707112 100644 --- a/AxibugEmuOnline.Client/Assets/Script/ControlSchemes/NesGamingScheme.cs +++ b/AxibugEmuOnline.Client/Assets/Script/ControlSchemes/NesGamingScheme.cs @@ -7,7 +7,13 @@ namespace AxibugEmuOnline.Client { public override void SetUIKeys(Dictionary uiKeyMapper) { - base.SetUIKeys(uiKeyMapper); + uiKeyMapper[KeyCode.Escape] = EnumCommand.OptionMenu; + + if (Application.platform == RuntimePlatform.PSP2) + { + uiKeyMapper[Common.PSVitaKey.L] = EnumCommand.OptionMenu; + uiKeyMapper[Common.PSVitaKey.R] = EnumCommand.OptionMenu; + } } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs index 000df4e..d953740 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/CommandDispatcher/CommandDispatcher.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using UnityEngine; @@ -14,8 +15,6 @@ namespace AxibugEmuOnline.Client Dictionary m_keyMapper = new Dictionary(); - public Dictionary GetKeyMapper() => m_keyMapper; - private void Awake() { Instance = this; @@ -74,6 +73,15 @@ namespace AxibugEmuOnline.Client } } } + + if (m_waitMapperSetting != null) + m_keyMapper = m_waitMapperSetting; + } + + private Dictionary m_waitMapperSetting = null; + public void SetKeyMapper(Dictionary mapper) + { + m_waitMapperSetting = mapper; } private List peekRegister(List results) @@ -103,12 +111,14 @@ namespace AxibugEmuOnline.Client return results; } + #if UNITY_EDITOR public void GetRegisters(out IReadOnlyList normal, out IReadOnlyList alone) { normal = m_register; alone = m_registerHigh; } + #endif } } diff --git a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs index 0057357..e01c88a 100644 --- a/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs +++ b/AxibugEmuOnline.Client/Assets/Script/UI/OptionUI/OptionUI.cs @@ -110,6 +110,7 @@ namespace AxibugEmuOnline.Client } } + ControlScheme m_lastCS; public void Pop(List menus, int defaultIndex = 0) { ReleaseRuntimeMenus(); @@ -144,7 +145,10 @@ namespace AxibugEmuOnline.Client 0.3f ).SetEase(Ease.OutCubic); + m_lastCS = ControlScheme.Current; + ControlScheme.Current = ControlSchemeSetts.Normal; } + } public void Hide() @@ -172,6 +176,8 @@ namespace AxibugEmuOnline.Client ).SetEase(Ease.OutCubic); m_bPoped = false; + + ControlScheme.Current = m_lastCS; } }