音频音效,AxiInput统一Axis
This commit is contained in:
parent
fd739b3d45
commit
1e502e1777
@ -251,6 +251,78 @@ MonoBehaviour:
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
--- !u!1 &4575283077718640688
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1022199480158774571}
|
||||
- component: {fileID: 2457497005019878394}
|
||||
- component: {fileID: 486071984201083045}
|
||||
m_Layer: 5
|
||||
m_Name: Game
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1022199480158774571
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4575283077718640688}
|
||||
m_LocalRotation: {x: 1, y: 0, z: 0, w: 0}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4829774629647575852}
|
||||
m_LocalEulerAnglesHint: {x: 180, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2457497005019878394
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4575283077718640688}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &486071984201083045
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4575283077718640688}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Texture: {fileID: 0}
|
||||
m_UVRect:
|
||||
serializedVersion: 2
|
||||
x: 0
|
||||
y: 0
|
||||
width: 1
|
||||
height: 1
|
||||
--- !u!1 &5558964681998005947
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -282,6 +354,7 @@ RectTransform:
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 1022199480158774571}
|
||||
- {fileID: 153069469667130431}
|
||||
m_Father: {fileID: 1697793132499616605}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -79,6 +79,30 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool GetKeyUp(EnumCommand Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].IsKeyUp())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool GetKeyDown(EnumCommand Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].IsKeyDown())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
@ -114,6 +138,14 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
{
|
||||
return GetKey((EnumCommand)Key);
|
||||
}
|
||||
public bool GetKeyDown(ulong Key)
|
||||
{
|
||||
return GetKeyDown((EnumCommand)Key);
|
||||
}
|
||||
public bool GetKeyUp(ulong Key)
|
||||
{
|
||||
return GetKeyUp((EnumCommand)Key);
|
||||
}
|
||||
|
||||
internal EnumCommand[] GetAllCmd()
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AxibugEmuOnline.Client.Common;
|
||||
using AxibugEmuOnline.Client;
|
||||
using AxibugEmuOnline.Client.Common;
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
@ -134,11 +135,45 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool GetKeyUp(UMAMEKSingleKey Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].IsKeyUp())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GetKeyDown(UMAMEKSingleKey Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].IsKeyDown())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public bool GetKey(ulong Key)
|
||||
{
|
||||
return GetKey((UMAMEKSingleKey)Key);
|
||||
}
|
||||
public bool GetKeyDown(ulong Key)
|
||||
{
|
||||
return GetKeyDown((UMAMEKSingleKey)Key);
|
||||
}
|
||||
public bool GetKeyUp(ulong Key)
|
||||
{
|
||||
return GetKeyUp((UMAMEKSingleKey)Key);
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
|
@ -57,6 +57,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
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.Escape));
|
||||
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(KeyCode.I));
|
||||
|
||||
//Axis
|
||||
@ -110,6 +111,31 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool GetKeyUp(EnumCommand Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].IsKeyUp())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GetKeyDown(EnumCommand Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].IsKeyDown())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
@ -145,6 +171,14 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
{
|
||||
return GetKey((EnumCommand)Key);
|
||||
}
|
||||
public bool GetKeyDown(ulong Key)
|
||||
{
|
||||
return GetKeyDown((EnumCommand)Key);
|
||||
}
|
||||
public bool GetKeyUp(ulong Key)
|
||||
{
|
||||
return GetKeyUp((EnumCommand)Key);
|
||||
}
|
||||
|
||||
internal EnumCommand[] GetAllCmd()
|
||||
{
|
||||
|
@ -0,0 +1,85 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Script.AppMain.AxiInput
|
||||
{
|
||||
public static class AxiInputAxisCenter
|
||||
{
|
||||
static long LastCheckFrame = -1;
|
||||
|
||||
public enum AxisState
|
||||
{
|
||||
None,
|
||||
KeyUp,
|
||||
KeyDown,
|
||||
KeyHold
|
||||
}
|
||||
|
||||
static Dictionary<AxiInputAxisType, AxisState> mAxis2State = new Dictionary<AxiInputAxisType, AxisState>()
|
||||
{
|
||||
{AxiInputAxisType.RIGHT,AxisState.None},
|
||||
{AxiInputAxisType.LEFT,AxisState.None },
|
||||
{AxiInputAxisType.UP,AxisState.None},
|
||||
{AxiInputAxisType.DOWN,AxisState.None},
|
||||
};
|
||||
|
||||
public static bool GetKey(AxiInputAxisType axisType)
|
||||
{
|
||||
UpdateState();
|
||||
return mAxis2State[axisType] >= AxisState.KeyDown;
|
||||
}
|
||||
public static bool GetKeyDown(AxiInputAxisType axisType)
|
||||
{
|
||||
UpdateState();
|
||||
return mAxis2State[axisType] == AxisState.KeyDown;
|
||||
}
|
||||
public static bool GetKeyUp(AxiInputAxisType axisType)
|
||||
{
|
||||
UpdateState();
|
||||
return mAxis2State[axisType] == AxisState.KeyUp;
|
||||
}
|
||||
|
||||
public static void UpdateState()
|
||||
{
|
||||
if (LastCheckFrame == Time.frameCount)
|
||||
return;
|
||||
LastCheckFrame = Time.frameCount;
|
||||
RecheckSingleState(AxiInputAxisType.RIGHT);
|
||||
RecheckSingleState(AxiInputAxisType.LEFT);
|
||||
RecheckSingleState(AxiInputAxisType.UP);
|
||||
RecheckSingleState(AxiInputAxisType.DOWN);
|
||||
}
|
||||
|
||||
static void RecheckSingleState(AxiInputAxisType axisType)
|
||||
{
|
||||
bool bKey = false;
|
||||
switch (axisType)
|
||||
{
|
||||
case AxiInputAxisType.RIGHT: bKey = Input.GetAxis("Horizontal") > 0; break;
|
||||
case AxiInputAxisType.LEFT: bKey = Input.GetAxis("Horizontal") < 0; break;
|
||||
case AxiInputAxisType.UP: bKey = Input.GetAxis("Vertical") > 0; break;
|
||||
case AxiInputAxisType.DOWN: bKey = Input.GetAxis("Vertical") < 0; break;
|
||||
}
|
||||
//按下
|
||||
if (bKey)
|
||||
{
|
||||
//如果之前帧是KeyUp或None,则为KeyDown|KeyHold
|
||||
if (mAxis2State[axisType] <= AxisState.KeyUp)
|
||||
mAxis2State[axisType] = AxisState.KeyDown;
|
||||
//如果之前帧是KeyDown,则为KeyHold
|
||||
else if (mAxis2State[axisType] == AxisState.KeyDown)
|
||||
mAxis2State[axisType] = AxisState.KeyHold;
|
||||
}
|
||||
//未按下
|
||||
else
|
||||
{
|
||||
//如果之前帧是KeyDown|KeyHold,则为KeyUp|None
|
||||
if (mAxis2State[axisType] >= AxisState.KeyDown)
|
||||
mAxis2State[axisType] = AxisState.KeyUp;
|
||||
//如果之前帧是KeyUp,则为None
|
||||
else if (mAxis2State[axisType] == AxisState.KeyUp)
|
||||
mAxis2State[axisType] = AxisState.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01ad5df3dbc7084429640ac4d51e4cb8
|
@ -35,19 +35,25 @@ namespace Assets.Script.AppMain.AxiInput
|
||||
{
|
||||
case AxiInputType.UNITY_KEYCODE:
|
||||
return Input.GetKeyDown(axiInput.KeyCodeValue);
|
||||
case AxiInputType.UNITY_AXIS://AXIS 不考虑KeyDown情况
|
||||
{
|
||||
switch (axiInput.AxisType)
|
||||
{
|
||||
case AxiInputAxisType.RIGHT: return Input.GetAxis("Horizontal") > 0;
|
||||
case AxiInputAxisType.LEFT: return Input.GetAxis("Horizontal") < 0;
|
||||
case AxiInputAxisType.UP: return Input.GetAxis("Vertical") > 0;
|
||||
case AxiInputAxisType.DOWN: return Input.GetAxis("Vertical") < 0;
|
||||
default: return false;
|
||||
}
|
||||
}
|
||||
case AxiInputType.UNITY_AXIS:
|
||||
return AxiInputAxisCenter.GetKeyDown(axiInput.AxisType);
|
||||
case AxiInputType.UNITY_UGUI_BTN:
|
||||
return AxiInputUGUICenter.IsKeyDown(axiInput.UguiBtn);
|
||||
return AxiInputUGUICenter.GetKeyDown(axiInput.UguiBtn);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsKeyUp(this AxiInput axiInput)
|
||||
{
|
||||
switch (axiInput.type)
|
||||
{
|
||||
case AxiInputType.UNITY_KEYCODE:
|
||||
return Input.GetKeyUp(axiInput.KeyCodeValue);
|
||||
case AxiInputType.UNITY_AXIS:
|
||||
return AxiInputAxisCenter.GetKeyUp(axiInput.AxisType);
|
||||
case AxiInputType.UNITY_UGUI_BTN:
|
||||
return AxiInputUGUICenter.GetKeyUp(axiInput.UguiBtn);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -59,10 +65,10 @@ namespace Assets.Script.AppMain.AxiInput
|
||||
{
|
||||
case AxiInputType.UNITY_KEYCODE:
|
||||
return Input.GetKey(axiInput.KeyCodeValue);
|
||||
case AxiInputType.UNITY_AXIS://AXIS 不考虑KeyDown情况
|
||||
return false;
|
||||
case AxiInputType.UNITY_AXIS:
|
||||
return AxiInputAxisCenter.GetKey(axiInput.AxisType);
|
||||
case AxiInputType.UNITY_UGUI_BTN:
|
||||
return AxiInputUGUICenter.IsKeyDown(axiInput.UguiBtn);
|
||||
return AxiInputUGUICenter.GetKey(axiInput.UguiBtn);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Assets.Script.AppMain.AxiInput
|
||||
{
|
||||
@ -37,27 +36,40 @@ namespace Assets.Script.AppMain.AxiInput
|
||||
}
|
||||
}
|
||||
|
||||
public static bool IsKeyDown(AxiInputUGuiBtnType btntype)
|
||||
public static bool GetKeyUp(AxiInputUGuiBtnType btntype)
|
||||
{
|
||||
List<AxiInputUGUIHandleBase> list;
|
||||
if (!dictBtnType2BtnList.TryGetValue(btntype, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].IsKeyDown())
|
||||
if (list[i].GetKeyUp())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsKey(AxiInputUGuiBtnType btntype)
|
||||
public static bool GetKeyDown(AxiInputUGuiBtnType btntype)
|
||||
{
|
||||
List<AxiInputUGUIHandleBase> list;
|
||||
if (!dictBtnType2BtnList.TryGetValue(btntype, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].IsKey())
|
||||
if (list[i].GetKeyDown())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool GetKey(AxiInputUGuiBtnType btntype)
|
||||
{
|
||||
List<AxiInputUGUIHandleBase> list;
|
||||
if (!dictBtnType2BtnList.TryGetValue(btntype, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].GetKey())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -15,8 +15,9 @@ namespace Assets.Script.AppMain.AxiInput
|
||||
this.UguiBtnType = uguiBtnType;
|
||||
AxiInputUGUICenter.RegHandle(this);
|
||||
}
|
||||
public abstract bool IsKeyDown();
|
||||
public abstract bool IsKey();
|
||||
public abstract bool GetKeyDown();
|
||||
public abstract bool GetKey();
|
||||
public abstract bool GetKeyUp();
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
@ -37,6 +37,8 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
void ClearAll();
|
||||
void SetKey(ulong Key, AxiInput input);
|
||||
bool GetKey(ulong Key);
|
||||
bool GetKeyDown(ulong Key);
|
||||
bool GetKeyUp(ulong Key);
|
||||
void ColletAllKey();
|
||||
bool HadAnyKeyDown();
|
||||
}
|
||||
|
@ -5,11 +5,32 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
using static UnityEditor.PlayerSettings;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public class AudioMgr : MonoBehaviour
|
||||
{
|
||||
public enum E_SFXTYPE
|
||||
{
|
||||
Cancel,
|
||||
Cursor,
|
||||
Option,
|
||||
Launch,
|
||||
system_ng,
|
||||
system_ok
|
||||
}
|
||||
|
||||
public Dictionary<E_SFXTYPE, AudioClip> dictAudioClip = new Dictionary<E_SFXTYPE, AudioClip>();
|
||||
|
||||
private AudioSource mSource;
|
||||
private void Awake()
|
||||
{
|
||||
mSource = this.gameObject.AddComponent<AudioSource>();
|
||||
LoadAudioClip();
|
||||
PlaySFX(E_SFXTYPE.Launch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 手动设置AudioCfg 主要用于模拟器各核心采样率对齐
|
||||
/// </summary>
|
||||
@ -44,6 +65,22 @@ namespace AxibugEmuOnline.Client
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadAudioClip()
|
||||
{
|
||||
dictAudioClip[E_SFXTYPE.Cancel] = Resources.Load<AudioClip>("Sound/XMBSFX/cancel");
|
||||
dictAudioClip[E_SFXTYPE.Cursor] = Resources.Load<AudioClip>("Sound/XMBSFX/cursor");
|
||||
dictAudioClip[E_SFXTYPE.Option] = Resources.Load<AudioClip>("Sound/XMBSFX/option");
|
||||
dictAudioClip[E_SFXTYPE.Launch] = Resources.Load<AudioClip>("Sound/XMBSFX/StartPSP");
|
||||
dictAudioClip[E_SFXTYPE.system_ng] = Resources.Load<AudioClip>("Sound/XMBSFX/system_ng");
|
||||
dictAudioClip[E_SFXTYPE.system_ok] = Resources.Load<AudioClip>("Sound/XMBSFX/system_ok");
|
||||
}
|
||||
|
||||
public void PlaySFX(E_SFXTYPE type, bool isLoop = false)
|
||||
{
|
||||
mSource.clip = dictAudioClip[type];
|
||||
mSource.loop = isLoop;
|
||||
mSource.Play();
|
||||
}
|
||||
|
||||
#region 录音功能实现
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using Assets.Script.AppMain.AxiInput;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using static UnityEditor.Progress;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
@ -14,30 +16,59 @@ namespace AxibugEmuOnline.Client
|
||||
Dictionary<EnumCommand, bool> m_dictLastState = new Dictionary<EnumCommand, bool>();
|
||||
EnumCommand[] m_checkCmds;
|
||||
List<CommandState> m_commands = new List<CommandState>();
|
||||
long CheckFrame = -1;
|
||||
IEnumerable<CommandState> GetCommand()
|
||||
{
|
||||
m_commands.Clear();
|
||||
//foreach (var item in m_keyMapper)
|
||||
//{
|
||||
// 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 (CheckFrame == Time.frameCount)
|
||||
return m_commands;
|
||||
CheckFrame = Time.frameCount;
|
||||
|
||||
m_commands.Clear();
|
||||
|
||||
//不再依赖KeyDown KeyUp的做法,兼容UGUI,或者Axis
|
||||
if (m_checkCmds != null)
|
||||
{
|
||||
foreach (var cmd in m_checkCmds)
|
||||
{
|
||||
bool oldstate = m_dictLastState[cmd];
|
||||
bool newstate = singleKeysSetting.GetKey((ulong)cmd);
|
||||
m_dictLastState[cmd] = newstate;
|
||||
if (oldstate != newstate)
|
||||
{
|
||||
m_commands.Add(new CommandState { Cmd = cmd, Cancel = !newstate });
|
||||
}
|
||||
if (singleKeysSetting.GetKeyDown((ulong)cmd)) m_commands.Add(new CommandState { Cmd = cmd, Cancel = false });
|
||||
if (singleKeysSetting.GetKeyUp((ulong)cmd)) m_commands.Add(new CommandState { Cmd = cmd, Cancel = true });
|
||||
|
||||
//if (m_dictLastState[cmd] && !singleKeysSetting.GetKey((ulong)cmd))
|
||||
//{
|
||||
// m_commands.Add(new CommandState { Cmd = cmd, Cancel = true });
|
||||
// m_dictLastState[cmd] = false;
|
||||
//}
|
||||
//else if (!m_dictLastState[cmd] && singleKeysSetting.GetKey((ulong)cmd))
|
||||
//{
|
||||
// m_commands.Add(new CommandState { Cmd = cmd, Cancel = false });
|
||||
// m_dictLastState[cmd] = true;
|
||||
//}
|
||||
|
||||
//bool oldstate = m_dictLastState[cmd];
|
||||
//bool newstate = singleKeysSetting.GetKey((ulong)cmd);
|
||||
//m_dictLastState[cmd] = newstate;
|
||||
//if (oldstate != newstate)
|
||||
//{
|
||||
// m_commands.Add(new CommandState { Cmd = cmd, Cancel = !newstate });
|
||||
//}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//foreach (var item in m_keyMapper)
|
||||
//{
|
||||
// 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 });
|
||||
//}
|
||||
|
||||
return m_commands;
|
||||
}
|
||||
public void ApplyKeyMapper(IKeyMapperChanger changer)
|
||||
@ -52,7 +83,7 @@ namespace AxibugEmuOnline.Client
|
||||
foreach (var cmd in arr)
|
||||
{
|
||||
if(!m_dictLastState.ContainsKey(cmd))
|
||||
m_dictLastState[cmd] = false;
|
||||
m_dictLastState[cmd] = true;
|
||||
}
|
||||
m_checkCmds = arr;
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
@ -119,6 +120,7 @@ namespace AxibugEmuOnline.Client.UI
|
||||
targetPosition,
|
||||
HoriRollSpd)
|
||||
.SetSpeedBased();
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Option);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
using DG.Tweening;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
using UnityEngine;
|
||||
@ -106,6 +107,8 @@ namespace AxibugEmuOnline.Client.UI
|
||||
|
||||
if (m_select) OnSelected(m_progress);
|
||||
});
|
||||
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Cursor);
|
||||
}
|
||||
|
||||
protected virtual void OnSelected(float progress) { }
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using DG.Tweening;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using DG.Tweening;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
@ -38,7 +39,8 @@ namespace AxibugEmuOnline.Client
|
||||
if (InfoNode != null) InfoNode.alpha = m_progress;
|
||||
|
||||
Root.localScale = Vector3.one * Mathf.Lerp(UnSelectScale, SelectScale, m_progress);
|
||||
});
|
||||
});
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Cursor);
|
||||
}
|
||||
|
||||
public override bool OnEnterItem()
|
||||
|
Loading…
Reference in New Issue
Block a user