Input完善和SFX完善
This commit is contained in:
parent
9221806669
commit
493a5de19f
@ -1,16 +1,12 @@
|
||||
using AxibugEmuOnline.Client;
|
||||
using AxibugEmuOnline.Client.Common;
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
{
|
||||
public class GamingMultiKeysSetting : MultiKeysSetting
|
||||
public class GamingMultiKeysSetting : MultiKeysSettingBase
|
||||
{
|
||||
public GamingSingleKeysSeting[] controllers;
|
||||
|
||||
public GamingMultiKeysSetting()
|
||||
{
|
||||
controllers = new GamingSingleKeysSeting[1];
|
||||
@ -18,21 +14,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
controllers[i] = new GamingSingleKeysSeting();
|
||||
}
|
||||
|
||||
public bool HadAnyKeyDown(int index)
|
||||
{
|
||||
if (index >= controllers.Length)
|
||||
return false;
|
||||
return controllers[index].HadAnyKeyDown();
|
||||
}
|
||||
public void ClearAll()
|
||||
{
|
||||
for (int i = 0; i < controllers.Length; i++)
|
||||
{
|
||||
controllers[i].ClearAll();
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadDefaultSetting()
|
||||
public override void LoadDefaultSetting()
|
||||
{
|
||||
ClearAll();
|
||||
|
||||
@ -54,103 +36,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
}
|
||||
}
|
||||
|
||||
public class GamingSingleKeysSeting : SingleKeysSetting
|
||||
public class GamingSingleKeysSeting : SingleKeySettingBase
|
||||
{
|
||||
Dictionary<EnumCommand, List<AxiInput>> DictSkey2AxiInput = new Dictionary<EnumCommand, List<AxiInput>>();
|
||||
AxiInput[] AxiInputArr = null;
|
||||
|
||||
public void SetKey(ulong Key, AxiInput input)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue((EnumCommand)Key, out list))
|
||||
list = DictSkey2AxiInput[(EnumCommand)Key] = ObjectPoolAuto.AcquireList<AxiInput>();
|
||||
list.Add(input);
|
||||
}
|
||||
|
||||
public bool GetKey(EnumCommand Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].GetKey())
|
||||
return true;
|
||||
}
|
||||
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].GetKeyUp())
|
||||
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].GetKeyDown())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
foreach (List<AxiInput> singlelist in DictSkey2AxiInput.Values)
|
||||
ObjectPoolAuto.Release(singlelist);
|
||||
DictSkey2AxiInput.Clear();
|
||||
AxiInputArr = null;
|
||||
}
|
||||
|
||||
public void ColletAllKey()
|
||||
{
|
||||
List<AxiInput> list = ObjectPoolAuto.AcquireList<AxiInput>();
|
||||
foreach (List<AxiInput> singlelist in DictSkey2AxiInput.Values)
|
||||
list.AddRange(singlelist);
|
||||
AxiInputArr = list.ToArray();
|
||||
ObjectPoolAuto.Release(list);
|
||||
}
|
||||
|
||||
public bool HadAnyKeyDown()
|
||||
{
|
||||
if (AxiInputArr == null)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < AxiInputArr.Length; i++)
|
||||
{
|
||||
if (AxiInputArr[i].GetKey())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GetKey(ulong Key)
|
||||
{
|
||||
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()
|
||||
{
|
||||
return DictSkey2AxiInput.Keys.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,4 @@
|
||||
using AxibugEmuOnline.Client;
|
||||
using AxibugEmuOnline.Client.Common;
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System.Collections.Generic;
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
@ -21,32 +18,16 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
BTN_E,
|
||||
BTN_F
|
||||
}
|
||||
public class UMAMEMultiKeysSetting : MultiKeysSetting
|
||||
public class UMAMEMultiKeysSetting : MultiKeysSettingBase
|
||||
{
|
||||
public UMAMEKSingleKeysSeting[] controllers;
|
||||
|
||||
public UMAMEMultiKeysSetting()
|
||||
{
|
||||
controllers = new UMAMEKSingleKeysSeting[4];
|
||||
controllers = new UMAMEKSingleKeysSeting[1];
|
||||
for (int i = 0; i < controllers.Length; i++)
|
||||
controllers[i] = new UMAMEKSingleKeysSeting();
|
||||
}
|
||||
|
||||
public bool HadAnyKeyDown(int index)
|
||||
{
|
||||
if (index >= controllers.Length)
|
||||
return false;
|
||||
return controllers[index].HadAnyKeyDown();
|
||||
}
|
||||
public void ClearAll()
|
||||
{
|
||||
for (int i = 0; i < controllers.Length; i++)
|
||||
{
|
||||
controllers[i].ClearAll();
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadDefaultSetting()
|
||||
public override void LoadDefaultSetting()
|
||||
{
|
||||
ClearAll();
|
||||
#if UNITY_PSP2 && !UNITY_EDITOR
|
||||
@ -110,100 +91,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
public class UMAMEKSingleKeysSeting : SingleKeysSetting
|
||||
public class UMAMEKSingleKeysSeting : SingleKeySettingBase
|
||||
{
|
||||
Dictionary<UMAMEKSingleKey, List<AxiInput>> DictSkey2AxiInput = new Dictionary<UMAMEKSingleKey, List<AxiInput>>();
|
||||
AxiInput[] AxiInputArr = null;
|
||||
|
||||
public void SetKey(ulong Key, AxiInput input)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue((UMAMEKSingleKey)Key, out list))
|
||||
list = DictSkey2AxiInput[(UMAMEKSingleKey)Key] = ObjectPoolAuto.AcquireList<AxiInput>();
|
||||
list.Add(input);
|
||||
}
|
||||
|
||||
public bool GetKey(UMAMEKSingleKey Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].GetKey())
|
||||
return true;
|
||||
}
|
||||
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].GetKeyUp())
|
||||
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].GetKeyDown())
|
||||
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()
|
||||
{
|
||||
foreach (List<AxiInput> singlelist in DictSkey2AxiInput.Values)
|
||||
ObjectPoolAuto.Release(singlelist);
|
||||
DictSkey2AxiInput.Clear();
|
||||
AxiInputArr = null;
|
||||
}
|
||||
|
||||
public void ColletAllKey()
|
||||
{
|
||||
List<AxiInput> list = ObjectPoolAuto.AcquireList<AxiInput>();
|
||||
foreach (List<AxiInput> singlelist in DictSkey2AxiInput.Values)
|
||||
list.AddRange(singlelist);
|
||||
AxiInputArr = list.ToArray();
|
||||
ObjectPoolAuto.Release(list);
|
||||
}
|
||||
|
||||
public bool HadAnyKeyDown()
|
||||
{
|
||||
if (AxiInputArr == null)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < AxiInputArr.Length; i++)
|
||||
{
|
||||
if (AxiInputArr[i].GetKey())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,12 @@
|
||||
using AxibugEmuOnline.Client;
|
||||
using AxibugEmuOnline.Client.Common;
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
{
|
||||
public class XMBMultiKeysSetting : MultiKeysSetting
|
||||
public class XMBMultiKeysSetting : MultiKeysSettingBase
|
||||
{
|
||||
public XMBSingleKeysSeting[] controllers;
|
||||
|
||||
public XMBMultiKeysSetting()
|
||||
{
|
||||
controllers = new XMBSingleKeysSeting[1];
|
||||
@ -20,21 +14,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
controllers[i] = new XMBSingleKeysSeting();
|
||||
}
|
||||
|
||||
public bool HadAnyKeyDown(int index)
|
||||
{
|
||||
if (index >= controllers.Length)
|
||||
return false;
|
||||
return controllers[index].HadAnyKeyDown();
|
||||
}
|
||||
public void ClearAll()
|
||||
{
|
||||
for (int i = 0; i < controllers.Length; i++)
|
||||
{
|
||||
controllers[i].ClearAll();
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadDefaultSetting()
|
||||
public override void LoadDefaultSetting()
|
||||
{
|
||||
ClearAll();
|
||||
|
||||
@ -86,104 +66,7 @@ namespace Assets.Script.AppMain.AxiInput.Settings
|
||||
}
|
||||
}
|
||||
|
||||
public class XMBSingleKeysSeting : SingleKeysSetting
|
||||
public class XMBSingleKeysSeting : SingleKeySettingBase
|
||||
{
|
||||
Dictionary<EnumCommand, List<AxiInput>> DictSkey2AxiInput = new Dictionary<EnumCommand, List<AxiInput>>();
|
||||
AxiInput[] AxiInputArr = null;
|
||||
|
||||
public void SetKey(ulong Key, AxiInput input)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue((EnumCommand)Key, out list))
|
||||
list = DictSkey2AxiInput[(EnumCommand)Key] = ObjectPoolAuto.AcquireList<AxiInput>();
|
||||
list.Add(input);
|
||||
}
|
||||
|
||||
public bool GetKey(EnumCommand Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!DictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].GetKey())
|
||||
return true;
|
||||
}
|
||||
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].GetKeyUp())
|
||||
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].GetKeyDown())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
foreach (List<AxiInput> singlelist in DictSkey2AxiInput.Values)
|
||||
ObjectPoolAuto.Release(singlelist);
|
||||
DictSkey2AxiInput.Clear();
|
||||
AxiInputArr = null;
|
||||
}
|
||||
|
||||
public void ColletAllKey()
|
||||
{
|
||||
List<AxiInput> list = ObjectPoolAuto.AcquireList<AxiInput>();
|
||||
foreach (List<AxiInput> singlelist in DictSkey2AxiInput.Values)
|
||||
list.AddRange(singlelist);
|
||||
AxiInputArr = list.ToArray();
|
||||
ObjectPoolAuto.Release(list);
|
||||
}
|
||||
|
||||
public bool HadAnyKeyDown()
|
||||
{
|
||||
if (AxiInputArr == null)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < AxiInputArr.Length; i++)
|
||||
{
|
||||
if (AxiInputArr[i].GetKey())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GetKey(ulong Key)
|
||||
{
|
||||
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()
|
||||
{
|
||||
return DictSkey2AxiInput.Keys.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -335,18 +335,18 @@ public class MameSingleConoller : IController
|
||||
CurrLocalSingleAllInput = 0;
|
||||
|
||||
var keys = App.input.mame.controllers[ControllerIndex];
|
||||
if (keys.GetKey(UMAMEKSingleKey.INSERT_COIN)) CurrLocalSingleAllInput |= (ulong)tg_INSERT_COIN;
|
||||
if (keys.GetKey(UMAMEKSingleKey.GAMESTART)) CurrLocalSingleAllInput |= (ulong)tg_GAMESTART;
|
||||
if (keys.GetKey(UMAMEKSingleKey.UP)) CurrLocalSingleAllInput |= (ulong)tg_UP;
|
||||
if (keys.GetKey(UMAMEKSingleKey.DOWN)) CurrLocalSingleAllInput |= (ulong)tg_DOWN;
|
||||
if (keys.GetKey(UMAMEKSingleKey.LEFT)) CurrLocalSingleAllInput |= (ulong)tg_LEFT;
|
||||
if (keys.GetKey(UMAMEKSingleKey.RIGHT)) CurrLocalSingleAllInput |= (ulong)tg_RIGHT;
|
||||
if (keys.GetKey(UMAMEKSingleKey.BTN_A)) CurrLocalSingleAllInput |= (ulong)tg_BTN_A;
|
||||
if (keys.GetKey(UMAMEKSingleKey.BTN_B)) CurrLocalSingleAllInput |= (ulong)tg_BTN_B;
|
||||
if (keys.GetKey(UMAMEKSingleKey.BTN_C)) CurrLocalSingleAllInput |= (ulong)tg_BTN_C;
|
||||
if (keys.GetKey(UMAMEKSingleKey.BTN_D)) CurrLocalSingleAllInput |= (ulong)tg_BTN_D;
|
||||
if (keys.GetKey(UMAMEKSingleKey.BTN_E)) CurrLocalSingleAllInput |= (ulong)tg_BTN_E;
|
||||
if (keys.GetKey(UMAMEKSingleKey.BTN_F)) CurrLocalSingleAllInput |= (ulong)tg_BTN_F;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.INSERT_COIN)) CurrLocalSingleAllInput |= (ulong)tg_INSERT_COIN;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.GAMESTART)) CurrLocalSingleAllInput |= (ulong)tg_GAMESTART;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.UP)) CurrLocalSingleAllInput |= (ulong)tg_UP;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.DOWN)) CurrLocalSingleAllInput |= (ulong)tg_DOWN;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.LEFT)) CurrLocalSingleAllInput |= (ulong)tg_LEFT;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.RIGHT)) CurrLocalSingleAllInput |= (ulong)tg_RIGHT;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.BTN_A)) CurrLocalSingleAllInput |= (ulong)tg_BTN_A;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.BTN_B)) CurrLocalSingleAllInput |= (ulong)tg_BTN_B;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.BTN_C)) CurrLocalSingleAllInput |= (ulong)tg_BTN_C;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.BTN_D)) CurrLocalSingleAllInput |= (ulong)tg_BTN_D;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.BTN_E)) CurrLocalSingleAllInput |= (ulong)tg_BTN_E;
|
||||
if (keys.GetKey((ulong)UMAMEKSingleKey.BTN_F)) CurrLocalSingleAllInput |= (ulong)tg_BTN_F;
|
||||
|
||||
//if (Input.GetKey(INSERT_COIN)) CurrLocalSingleAllInput |= (ulong)tg_INSERT_COIN;
|
||||
//if (Input.GetKey(GAMESTART)) CurrLocalSingleAllInput |= (ulong)tg_GAMESTART;
|
||||
|
@ -1,5 +1,7 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using Assets.Script.AppMain.AxiInput.Settings;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
@ -7,7 +9,7 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public override EnumCommand[] GetConfig()
|
||||
{
|
||||
return App.input.gaming.controllers[0].GetAllCmd();
|
||||
return App.input.gaming.controllers[0].GetAllCmd<EnumCommand>();
|
||||
}
|
||||
|
||||
public override SingleKeysSetting GetKeySetting()
|
||||
|
@ -1,5 +1,7 @@
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using Assets.Script.AppMain.AxiInput.Settings;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.Manager;
|
||||
using System;
|
||||
|
||||
namespace AxibugEmuOnline.Client
|
||||
{
|
||||
@ -8,7 +10,7 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
public override EnumCommand[] GetConfig()
|
||||
{
|
||||
return App.input.xmb.controllers[0].GetAllCmd();
|
||||
return App.input.xmb.controllers[0].GetAllCmd<EnumCommand>();
|
||||
}
|
||||
|
||||
public override SingleKeysSetting GetKeySetting()
|
||||
|
@ -1,5 +1,10 @@
|
||||
using Assets.Script.AppMain.AxiInput;
|
||||
using Assets.Script.AppMain.AxiInput.Settings;
|
||||
using AxibugEmuOnline.Client.Common;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements.Experimental;
|
||||
|
||||
namespace AxibugEmuOnline.Client.Manager
|
||||
@ -31,7 +36,6 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
void ClearAll();
|
||||
void LoadDefaultSetting();
|
||||
}
|
||||
|
||||
public interface SingleKeysSetting
|
||||
{
|
||||
void ClearAll();
|
||||
@ -43,4 +47,111 @@ namespace AxibugEmuOnline.Client.Manager
|
||||
bool HadAnyKeyDown();
|
||||
}
|
||||
|
||||
public abstract class MultiKeysSettingBase : MultiKeysSetting
|
||||
{
|
||||
public SingleKeySettingBase[] controllers;
|
||||
|
||||
public bool HadAnyKeyDown(int index)
|
||||
{
|
||||
if (index >= controllers.Length)
|
||||
return false;
|
||||
return controllers[index].HadAnyKeyDown();
|
||||
}
|
||||
public void ClearAll()
|
||||
{
|
||||
for (int i = 0; i < controllers.Length; i++)
|
||||
controllers[i].ClearAll();
|
||||
}
|
||||
|
||||
public abstract void LoadDefaultSetting();
|
||||
}
|
||||
|
||||
|
||||
public abstract class SingleKeySettingBase : SingleKeysSetting
|
||||
{
|
||||
protected Dictionary<ulong, List<AxiInput>> mDictSkey2AxiInput = new Dictionary<ulong, List<AxiInput>>();
|
||||
protected AxiInput[] AxiInputArr = null;
|
||||
|
||||
public void SetKey(ulong Key, AxiInput input)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!mDictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
list = mDictSkey2AxiInput[Key] = ObjectPoolAuto.AcquireList<AxiInput>();
|
||||
list.Add(input);
|
||||
}
|
||||
|
||||
public bool GetKey(ulong Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!mDictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].GetKey())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public bool GetKeyUp(ulong Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!mDictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].GetKeyUp())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GetKeyDown(ulong Key)
|
||||
{
|
||||
List<AxiInput> list;
|
||||
if (!mDictSkey2AxiInput.TryGetValue(Key, out list))
|
||||
return false;
|
||||
for (int i = 0; i < list.Count; i++)
|
||||
{
|
||||
if (list[i].GetKeyDown())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
{
|
||||
foreach (List<AxiInput> singlelist in mDictSkey2AxiInput.Values)
|
||||
ObjectPoolAuto.Release(singlelist);
|
||||
mDictSkey2AxiInput.Clear();
|
||||
AxiInputArr = null;
|
||||
}
|
||||
|
||||
public void ColletAllKey()
|
||||
{
|
||||
List<AxiInput> list = ObjectPoolAuto.AcquireList<AxiInput>();
|
||||
foreach (List<AxiInput> singlelist in mDictSkey2AxiInput.Values)
|
||||
list.AddRange(singlelist);
|
||||
AxiInputArr = list.ToArray();
|
||||
ObjectPoolAuto.Release(list);
|
||||
}
|
||||
|
||||
public bool HadAnyKeyDown()
|
||||
{
|
||||
if (AxiInputArr == null)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < AxiInputArr.Length; i++)
|
||||
{
|
||||
if (AxiInputArr[i].GetKey())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public T[] GetAllCmd<T>()
|
||||
{
|
||||
return mDictSkey2AxiInput.Keys.Select(k => (T)Enum.ToObject(typeof(T), k)).ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -129,13 +129,17 @@ namespace AxibugEmuOnline.Client.UI
|
||||
|
||||
protected override void OnCmdSelectItemLeft()
|
||||
{
|
||||
int old = SelectIndex;
|
||||
SelectIndex--;
|
||||
if (old != SelectIndex)
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Option);
|
||||
}
|
||||
|
||||
protected override void OnCmdSelectItemRight()
|
||||
{
|
||||
int old = SelectIndex;
|
||||
SelectIndex++;
|
||||
if (old != SelectIndex)
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Option);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using AxibugEmuOnline.Client.ClientCore;
|
||||
using AxibugEmuOnline.Client.UI;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
|
@ -303,15 +303,17 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
protected override void OnCmdSelectItemDown()
|
||||
{
|
||||
int old = SelectIndex;
|
||||
SelectIndex++;
|
||||
//TODO 已经到底的情况下,不播放音效
|
||||
if (old != SelectIndex)
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Option);
|
||||
}
|
||||
|
||||
protected override void OnCmdSelectItemUp()
|
||||
{
|
||||
int old = SelectIndex;
|
||||
SelectIndex--;
|
||||
//TODO 已经到顶的情况下,不播放音效
|
||||
if (old != SelectIndex)
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Option);
|
||||
}
|
||||
|
||||
|
@ -76,22 +76,24 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
protected override void OnCmdBack()
|
||||
{
|
||||
if (m_enteredItem != null)
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Cancel);
|
||||
|
||||
base.OnCmdBack();
|
||||
|
||||
LaunchUI.Instance.ToMainMenuLayout();
|
||||
var item = GetItemUIByIndex(SelectIndex);
|
||||
item.SetSelectState(true);
|
||||
//TODO 已经关闭三级菜单的情况下 不播放
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Cancel);
|
||||
}
|
||||
|
||||
protected override void OnCmdSelectItemUp()
|
||||
{
|
||||
if (m_enteredItem == null)
|
||||
{
|
||||
int old = SelectIndex;
|
||||
SelectIndex--;
|
||||
//TODO 已经到底的情况下,不播放音效
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Option);
|
||||
if (old != SelectIndex)
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Cursor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,9 +101,10 @@ namespace AxibugEmuOnline.Client
|
||||
{
|
||||
if (m_enteredItem == null)
|
||||
{
|
||||
int old = SelectIndex;
|
||||
SelectIndex++;
|
||||
//TODO 已经到顶的情况下,不播放音效
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Option);
|
||||
if (old != SelectIndex)
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Cursor);
|
||||
}
|
||||
}
|
||||
|
||||
@ -130,9 +133,13 @@ namespace AxibugEmuOnline.Client
|
||||
|
||||
protected override void OnCmdSelectItemLeft()
|
||||
{
|
||||
if(m_enteredItem != null)
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Cancel);
|
||||
else
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Option);
|
||||
|
||||
base.OnCmdSelectItemLeft();
|
||||
OnCmdBack();
|
||||
App.audioMgr.PlaySFX(AudioMgr.E_SFXTYPE.Cancel);
|
||||
}
|
||||
|
||||
protected override void OnSelectMenuChanged()
|
||||
|
Loading…
Reference in New Issue
Block a user