fixed axiinput
This commit is contained in:
parent
7832b9979c
commit
ad6d34ad13
AxibugEmuOnline.Client/Assets/Script/AppMain
AxiInput.Settings
UI/CommandDispatcher
@ -102,7 +102,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
|||||||
if (AxiInputArr == null)
|
if (AxiInputArr == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int i = 0; AxiInputArr.Length > 0; i++)
|
for (int i = 0; i < AxiInputArr.Length; i++)
|
||||||
{
|
{
|
||||||
if (AxiInputArr[i].IsKey())
|
if (AxiInputArr[i].IsKey())
|
||||||
return true;
|
return true;
|
||||||
|
@ -162,7 +162,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
|||||||
if (AxiInputArr == null)
|
if (AxiInputArr == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int i = 0; AxiInputArr.Length > 0; i++)
|
for (int i = 0; i < AxiInputArr.Length; i++)
|
||||||
{
|
{
|
||||||
if (AxiInputArr[i].IsKey())
|
if (AxiInputArr[i].IsKey())
|
||||||
return true;
|
return true;
|
||||||
|
@ -55,6 +55,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
|||||||
controllers[0].SetKey((ulong)EnumCommand.SelectItemLeft, AxiInputEx.ByKeyCode(KeyCode.A));
|
controllers[0].SetKey((ulong)EnumCommand.SelectItemLeft, AxiInputEx.ByKeyCode(KeyCode.A));
|
||||||
controllers[0].SetKey((ulong)EnumCommand.SelectItemRight, AxiInputEx.ByKeyCode(KeyCode.D));
|
controllers[0].SetKey((ulong)EnumCommand.SelectItemRight, AxiInputEx.ByKeyCode(KeyCode.D));
|
||||||
controllers[0].SetKey((ulong)EnumCommand.Enter, AxiInputEx.ByKeyCode(KeyCode.J));
|
controllers[0].SetKey((ulong)EnumCommand.Enter, AxiInputEx.ByKeyCode(KeyCode.J));
|
||||||
|
controllers[0].SetKey((ulong)EnumCommand.Enter, AxiInputEx.ByKeyCode(KeyCode.Return));
|
||||||
controllers[0].SetKey((ulong)EnumCommand.Back, AxiInputEx.ByKeyCode(KeyCode.K));
|
controllers[0].SetKey((ulong)EnumCommand.Back, AxiInputEx.ByKeyCode(KeyCode.K));
|
||||||
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(KeyCode.I));
|
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(KeyCode.I));
|
||||||
|
|
||||||
@ -132,7 +133,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
|||||||
if (AxiInputArr == null)
|
if (AxiInputArr == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int i = 0; AxiInputArr.Length > 0; i++)
|
for (int i = 0; i < AxiInputArr.Length; i++)
|
||||||
{
|
{
|
||||||
if (AxiInputArr[i].IsKey())
|
if (AxiInputArr[i].IsKey())
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
using AxibugEmuOnline.Client.ClientCore;
|
using AxibugEmuOnline.Client.ClientCore;
|
||||||
using AxibugEmuOnline.Client.Manager;
|
using AxibugEmuOnline.Client.Manager;
|
||||||
|
using System.CodeDom.Compiler;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using static UnityEditor.Progress;
|
|
||||||
|
|
||||||
namespace AxibugEmuOnline.Client
|
namespace AxibugEmuOnline.Client
|
||||||
{
|
{
|
||||||
@ -21,6 +22,8 @@ namespace AxibugEmuOnline.Client
|
|||||||
// if (Input.GetKeyDown(item.Key)) m_commands.Add(new CommandState { Cmd = item.Value, Cancel = false });
|
// if (Input.GetKeyDown(item.Key)) m_commands.Add(new CommandState { Cmd = item.Value, Cancel = false });
|
||||||
// if (Input.GetKeyUp(item.Key)) m_commands.Add(new CommandState { Cmd = item.Value, Cancel = true });
|
// if (Input.GetKeyUp(item.Key)) m_commands.Add(new CommandState { Cmd = item.Value, Cancel = true });
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
//不再依赖KeyDown KeyUp的做法,兼容UGUI,或者Axis
|
||||||
if (m_checkCmds != null)
|
if (m_checkCmds != null)
|
||||||
{
|
{
|
||||||
foreach (var cmd in m_checkCmds)
|
foreach (var cmd in m_checkCmds)
|
||||||
@ -41,11 +44,15 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
//var cfg = (Dictionary<KeyCode, EnumCommand>)changer.GetConfig();
|
//var cfg = (Dictionary<KeyCode, EnumCommand>)changer.GetConfig();
|
||||||
singleKeysSetting = changer.GetKeySetting();
|
singleKeysSetting = changer.GetKeySetting();
|
||||||
m_dictLastState.Clear();
|
App.log.Debug($"CommandListener ApplyKeyMapper | {Time.frameCount} {changer.Name}");
|
||||||
EnumCommand[] arr = changer.GetConfig();
|
EnumCommand[] arr = changer.GetConfig();
|
||||||
for (int i = 0; i < arr.Length; i++)
|
//不要直接清m_dictLastState.Clear(),同样的Key维持状态,避免造成多余CommandState
|
||||||
|
EnumCommand[] temp = m_dictLastState.Keys.ToArray();
|
||||||
|
//仅添加新增
|
||||||
|
foreach (var cmd in arr)
|
||||||
{
|
{
|
||||||
m_dictLastState[arr[i]] = false;
|
if(!m_dictLastState.ContainsKey(cmd))
|
||||||
|
m_dictLastState[cmd] = false;
|
||||||
}
|
}
|
||||||
m_checkCmds = arr;
|
m_checkCmds = arr;
|
||||||
}
|
}
|
||||||
@ -56,7 +63,7 @@ namespace AxibugEmuOnline.Client
|
|||||||
{
|
{
|
||||||
foreach (var executer in executers)
|
foreach (var executer in executers)
|
||||||
{
|
{
|
||||||
App.log.Debug($"{cmd.Cmd}|{cmd.Cancel}");
|
App.log.Debug($"CommandListener GetCommand | {Time.frameCount}|{executer.name}| {cmd.Cmd}|{cmd.Cancel}");
|
||||||
executer.ExecuteCommand(cmd.Cmd, cmd.Cancel);
|
executer.ExecuteCommand(cmd.Cmd, cmd.Cancel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user