diff --git a/AxibugEmuOnline.Client/Assets/Resources/EssgeeUnity/EssgeeUnity.prefab b/AxibugEmuOnline.Client/Assets/Resources/EssgeeUnity/EssgeeUnity.prefab index 6390a1c3..ce9129e9 100644 --- a/AxibugEmuOnline.Client/Assets/Resources/EssgeeUnity/EssgeeUnity.prefab +++ b/AxibugEmuOnline.Client/Assets/Resources/EssgeeUnity/EssgeeUnity.prefab @@ -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} diff --git a/AxibugEmuOnline.Client/Assets/Resources/Sound/XMBSFX/Start PSP.mp3 b/AxibugEmuOnline.Client/Assets/Resources/Sound/XMBSFX/StartPSP.mp3 similarity index 100% rename from AxibugEmuOnline.Client/Assets/Resources/Sound/XMBSFX/Start PSP.mp3 rename to AxibugEmuOnline.Client/Assets/Resources/Sound/XMBSFX/StartPSP.mp3 diff --git a/AxibugEmuOnline.Client/Assets/Resources/Sound/XMBSFX/Start PSP.mp3.meta b/AxibugEmuOnline.Client/Assets/Resources/Sound/XMBSFX/StartPSP.mp3.meta similarity index 100% rename from AxibugEmuOnline.Client/Assets/Resources/Sound/XMBSFX/Start PSP.mp3.meta rename to AxibugEmuOnline.Client/Assets/Resources/Sound/XMBSFX/StartPSP.mp3.meta diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/GamingMultiKeysSetting.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/GamingMultiKeysSetting.cs index ae206c73..e8757ec4 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/GamingMultiKeysSetting.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/GamingMultiKeysSetting.cs @@ -79,6 +79,30 @@ namespace Assets.Script.AppMain.AxiInput.Settings } return false; } + public bool GetKeyUp(EnumCommand Key) + { + List 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 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() { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/UMAMEMultiKeysSetting.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/UMAMEMultiKeysSetting.cs index d119a072..bfc15be3 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/UMAMEMultiKeysSetting.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/UMAMEMultiKeysSetting.cs @@ -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 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 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() { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/XMBMultiKeysSetting.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/XMBMultiKeysSetting.cs index 629b3094..9f9d1afb 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/XMBMultiKeysSetting.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput.Settings/XMBMultiKeysSetting.cs @@ -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 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 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() { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputAxisCenter.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputAxisCenter.cs new file mode 100644 index 00000000..68baed5b --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputAxisCenter.cs @@ -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 mAxis2State = new Dictionary() + { + {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; + } + } + } +} diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputAxisCenter.cs.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputAxisCenter.cs.meta new file mode 100644 index 00000000..387b2ba3 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputAxisCenter.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 01ad5df3dbc7084429640ac4d51e4cb8 \ No newline at end of file diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputEx.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputEx.cs index 7856a73c..d46465e6 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputEx.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputEx.cs @@ -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; } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputUGUICenter.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputUGUICenter.cs index 71d97039..d87ba1c7 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputUGUICenter.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputUGUICenter.cs @@ -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 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 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 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; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputUGUIHandleBase.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputUGUIHandleBase.cs index 7f0b04c5..ed1f3990 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputUGUIHandleBase.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/AxiInput/AxiInputUGUIHandleBase.cs @@ -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() { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppInput.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppInput.cs index 8e72ef4b..8d9f2f12 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppInput.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppInput.cs @@ -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(); } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/MonoCom/AudioMgr.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/MonoCom/AudioMgr.cs index 2c90746d..7df3b80d 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/MonoCom/AudioMgr.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/MonoCom/AudioMgr.cs @@ -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 dictAudioClip = new Dictionary(); + + private AudioSource mSource; + private void Awake() + { + mSource = this.gameObject.AddComponent(); + LoadAudioClip(); + PlaySFX(E_SFXTYPE.Launch); + } + /// /// 手动设置AudioCfg 主要用于模拟器各核心采样率对齐 /// @@ -44,6 +65,22 @@ namespace AxibugEmuOnline.Client } } + public void LoadAudioClip() + { + dictAudioClip[E_SFXTYPE.Cancel] = Resources.Load("Sound/XMBSFX/cancel"); + dictAudioClip[E_SFXTYPE.Cursor] = Resources.Load("Sound/XMBSFX/cursor"); + dictAudioClip[E_SFXTYPE.Option] = Resources.Load("Sound/XMBSFX/option"); + dictAudioClip[E_SFXTYPE.Launch] = Resources.Load("Sound/XMBSFX/StartPSP"); + dictAudioClip[E_SFXTYPE.system_ng] = Resources.Load("Sound/XMBSFX/system_ng"); + dictAudioClip[E_SFXTYPE.system_ok] = Resources.Load("Sound/XMBSFX/system_ok"); + } + + public void PlaySFX(E_SFXTYPE type, bool isLoop = false) + { + mSource.clip = dictAudioClip[type]; + mSource.loop = isLoop; + mSource.Play(); + } #region 录音功能实现 diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/CommandDispatcher/CommandListener.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/CommandDispatcher/CommandListener.cs index e865e10e..2be86f8a 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/CommandDispatcher/CommandListener.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/CommandDispatcher/CommandListener.cs @@ -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 m_dictLastState = new Dictionary(); EnumCommand[] m_checkCmds; List m_commands = new List(); + long CheckFrame = -1; IEnumerable 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; } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MainMenuController.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MainMenuController.cs index eea5a6a5..f14300a2 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MainMenuController.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MainMenuController.cs @@ -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 { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MenuItem.cs index e1deee62..b5958553 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/MenuItem.cs @@ -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) { } diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/ThirdMenuRoot.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/ThirdMenuRoot.cs index f8bd88ac..a1cb3dca 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/ThirdMenuRoot.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/ThirdMenuRoot.cs @@ -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; diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/VirtualSubMenuItem.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/VirtualSubMenuItem.cs index 96e6bc0e..256a58d1 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/VirtualSubMenuItem.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/VirtualSubMenuItem.cs @@ -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()