master #39

Merged
sin365 merged 7 commits from Alienjack/AxibugEmuOnline:master into master 2024-09-24 18:02:02 +08:00
5 changed files with 40 additions and 7 deletions
Showing only changes of commit ad021664db - Show all commits

View File

@ -27,6 +27,6 @@ namespace AxibugEmuOnline.Client.Common
public static KeyCode Up => KeyCode.Joystick1Button8; public static KeyCode Up => KeyCode.Joystick1Button8;
public static KeyCode Right => KeyCode.Joystick1Button9; public static KeyCode Right => KeyCode.Joystick1Button9;
public static KeyCode Down => KeyCode.Joystick1Button10; public static KeyCode Down => KeyCode.Joystick1Button10;
public static KeyCode Left => KeyCode.Joystick1Button11 public static KeyCode Left => KeyCode.Joystick1Button11;
} }
} }

View File

@ -13,7 +13,9 @@ namespace AxibugEmuOnline.Client
{ {
m_current = value; m_current = value;
m_current.SetUIKeys(CommandDispatcher.Instance.GetKeyMapper()); Dictionary<KeyCode, EnumCommand> mapper = new Dictionary<KeyCode, EnumCommand>();
m_current.SetUIKeys(mapper);
CommandDispatcher.Instance.SetKeyMapper(mapper);
} }
} }
@ -21,8 +23,6 @@ namespace AxibugEmuOnline.Client
public virtual void SetUIKeys(Dictionary<KeyCode, EnumCommand> uiKeyMapper) public virtual void SetUIKeys(Dictionary<KeyCode, EnumCommand> uiKeyMapper)
{ {
uiKeyMapper.Clear();
uiKeyMapper[KeyCode.A] = EnumCommand.SelectItemLeft; uiKeyMapper[KeyCode.A] = EnumCommand.SelectItemLeft;
uiKeyMapper[KeyCode.D] = EnumCommand.SelectItemRight; uiKeyMapper[KeyCode.D] = EnumCommand.SelectItemRight;
uiKeyMapper[KeyCode.W] = EnumCommand.SelectItemUp; uiKeyMapper[KeyCode.W] = EnumCommand.SelectItemUp;
@ -39,6 +39,17 @@ namespace AxibugEmuOnline.Client
uiKeyMapper[KeyCode.Escape] = EnumCommand.Back; uiKeyMapper[KeyCode.Escape] = EnumCommand.Back;
uiKeyMapper[KeyCode.RightShift] = EnumCommand.OptionMenu; uiKeyMapper[KeyCode.RightShift] = EnumCommand.OptionMenu;
uiKeyMapper[KeyCode.LeftShift] = 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;
}
} }
} }
} }

View File

@ -7,7 +7,13 @@ namespace AxibugEmuOnline.Client
{ {
public override void SetUIKeys(Dictionary<KeyCode, EnumCommand> uiKeyMapper) public override void SetUIKeys(Dictionary<KeyCode, EnumCommand> 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;
}
} }
} }

View File

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
@ -14,8 +15,6 @@ namespace AxibugEmuOnline.Client
Dictionary<KeyCode, EnumCommand> m_keyMapper = new Dictionary<KeyCode, EnumCommand>(); Dictionary<KeyCode, EnumCommand> m_keyMapper = new Dictionary<KeyCode, EnumCommand>();
public Dictionary<KeyCode, EnumCommand> GetKeyMapper() => m_keyMapper;
private void Awake() private void Awake()
{ {
Instance = this; Instance = this;
@ -74,6 +73,15 @@ namespace AxibugEmuOnline.Client
} }
} }
} }
if (m_waitMapperSetting != null)
m_keyMapper = m_waitMapperSetting;
}
private Dictionary<KeyCode, EnumCommand> m_waitMapperSetting = null;
public void SetKeyMapper(Dictionary<KeyCode, EnumCommand> mapper)
{
m_waitMapperSetting = mapper;
} }
private List<CommandExecuter> peekRegister(List<CommandExecuter> results) private List<CommandExecuter> peekRegister(List<CommandExecuter> results)
@ -103,12 +111,14 @@ namespace AxibugEmuOnline.Client
return results; return results;
} }
#if UNITY_EDITOR #if UNITY_EDITOR
public void GetRegisters(out IReadOnlyList<CommandExecuter> normal, out IReadOnlyList<CommandExecuter> alone) public void GetRegisters(out IReadOnlyList<CommandExecuter> normal, out IReadOnlyList<CommandExecuter> alone)
{ {
normal = m_register; normal = m_register;
alone = m_registerHigh; alone = m_registerHigh;
} }
#endif #endif
} }
} }

View File

@ -110,6 +110,7 @@ namespace AxibugEmuOnline.Client
} }
} }
ControlScheme m_lastCS;
public void Pop(List<OptionMenu> menus, int defaultIndex = 0) public void Pop(List<OptionMenu> menus, int defaultIndex = 0)
{ {
ReleaseRuntimeMenus(); ReleaseRuntimeMenus();
@ -144,7 +145,10 @@ namespace AxibugEmuOnline.Client
0.3f 0.3f
).SetEase(Ease.OutCubic); ).SetEase(Ease.OutCubic);
m_lastCS = ControlScheme.Current;
ControlScheme.Current = ControlSchemeSetts.Normal;
} }
} }
public void Hide() public void Hide()
@ -172,6 +176,8 @@ namespace AxibugEmuOnline.Client
).SetEase(Ease.OutCubic); ).SetEase(Ease.OutCubic);
m_bPoped = false; m_bPoped = false;
ControlScheme.Current = m_lastCS;
} }
} }