Input机制修改已完成

This commit is contained in:
ALIENJACK\alien 2025-04-01 15:35:17 +08:00
parent 34cf5487e8
commit cfb3bc8b6a
64 changed files with 699 additions and 1808 deletions
AxibugEmuOnline.Client/Assets
Resources/UIPrefabs
Scene
Script/AppMain
AxiInputSP.Settings
AxiInputSP
Emulator
EssgeeEmulator/UEssgeeInterface
MameEmulator/UniInterface
Manager
UI

View File

@ -54,7 +54,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
m_InputUI: {fileID: 3531919739979819165}
m_OptionUI: {fileID: 3531919738411886374}
m_Joystick: {fileID: 1479421568449666778}
m_screenGamepad: {fileID: 8310310311897327133}
m_popTipsUI: {fileID: 5244143219655022973}
--- !u!1001 &286598211728911619
PrefabInstance:
@ -924,6 +924,17 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 3557960760441770044, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
m_PrefabInstance: {fileID: 2731323643586367206}
m_PrefabAsset: {fileID: 0}
--- !u!114 &8310310311897327133 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6247543073642948859, guid: bb828a9e324f62649b40038f8cd3620a, type: 3}
m_PrefabInstance: {fileID: 2731323643586367206}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1c6e60f499349d7479c565da795cde9b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &6972157500961473863
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -1452,6 +1452,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 3557960760441770044}
- component: {fileID: 6247543073642948859}
m_Layer: 5
m_Name: ScreenKeyPad
m_TagString: Untagged
@ -1491,6 +1492,18 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &6247543073642948859
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3557960760441770047}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1c6e60f499349d7479c565da795cde9b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &3557960760443913721
GameObject:
m_ObjectHideFlags: 0

View File

@ -225,7 +225,7 @@ MonoBehaviour:
bUseLocalWebApi: 0
mLocalWebApi: http://localhost:5051
bEditorUUID: 0
bEditorOpenGUIJoyStick: 0
bEditorOpenGUIJoyStick: 1
--- !u!1 &1498586261
GameObject:
m_ObjectHideFlags: 3

View File

@ -1,86 +0,0 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Settings;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class ColecoVisionMultiKeysSetting : MultiKeysSettingBase
{
public ColecoVisionMultiKeysSetting()
{
controllers = new ColecoVisionSingleKeysSeting[4];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new ColecoVisionSingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_1, AxiInputEx.ByKeyCode(PSVitaKey.Start));
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_2, AxiInputEx.ByKeyCode(PSVitaKey.Select));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(PSVitaKey.Block));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(PSVitaKey.Triangle));
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
controllers[0].ColletAllKey();
return;
#endif
#region P1
//P1 键盘
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Return));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.RightShift));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.S));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.A));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.D));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.J));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.K));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.U));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.I));
//P1 UGUI
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.Delete));
controllers[1].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.UpArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.DownArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.LeftArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.RightArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.Keypad1));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.Keypad2));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.Keypad3));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.Keypad4));
controllers[0].ColletAllKey();
#endregion
}
}
public class ColecoVisionSingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 6febcf958b506d74aadb5e7ea35f1a9d

View File

@ -1,69 +0,0 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Settings;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class GameBoyColorMultiKeysSetting : MultiKeysSettingBase
{
public GameBoyColorMultiKeysSetting()
{
controllers = new GameBoyColorSingleKeysSeting[4];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new GameBoyColorSingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_1, AxiInputEx.ByKeyCode(PSVitaKey.Start));
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_2, AxiInputEx.ByKeyCode(PSVitaKey.Select));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
controllers[0].ColletAllKey();
return;
#endif
#region P1
//P1 键盘
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Return));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.RightShift));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.S));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.A));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.D));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.J));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.K));
//P1 UGUI
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].ColletAllKey();
#endregion
}
}
public class GameBoyColorSingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 98e9f2994f6a07c4fb69339055653348

View File

@ -1,69 +0,0 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Settings;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class GameBoyMultiKeysSetting : MultiKeysSettingBase
{
public GameBoyMultiKeysSetting()
{
controllers = new GameBoySingleKeysSeting[4];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new GameBoySingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_1, AxiInputEx.ByKeyCode(PSVitaKey.Start));
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_2, AxiInputEx.ByKeyCode(PSVitaKey.Select));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
controllers[0].ColletAllKey();
return;
#endif
#region P1
//P1 键盘
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Return));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.RightShift));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.S));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.A));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.D));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.J));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.K));
//P1 UGUI
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].ColletAllKey();
#endregion
}
}
public class GameBoySingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 42485ea83f647924e9e8a8db04c8b351

View File

@ -1,86 +0,0 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Settings;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class GameGearMultiKeysSetting : MultiKeysSettingBase
{
public GameGearMultiKeysSetting()
{
controllers = new GameGearSingleKeysSeting[4];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new GameGearSingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_1, AxiInputEx.ByKeyCode(PSVitaKey.Start));
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_2, AxiInputEx.ByKeyCode(PSVitaKey.Select));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(PSVitaKey.Block));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(PSVitaKey.Triangle));
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
controllers[0].ColletAllKey();
return;
#endif
#region P1
//P1 键盘
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Return));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.RightShift));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.S));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.A));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.D));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.J));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.K));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.U));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.I));
//P1 UGUI
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.Delete));
controllers[1].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.UpArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.DownArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.LeftArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.RightArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.Keypad1));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.Keypad2));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.Keypad3));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.Keypad4));
controllers[0].ColletAllKey();
#endregion
}
}
public class GameGearSingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 1f1d4c32b29ac4740945cb36c4442f70

View File

@ -1,43 +0,0 @@
using AxibugEmuOnline.Client;
using AxibugEmuOnline.Client.Common;
using AxibugEmuOnline.Client.Manager;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class GamingMultiKeysSetting : MultiKeysSettingBase
{
public GamingMultiKeysSetting()
{
controllers = new GamingSingleKeysSeting[1];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new GamingSingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
if (Application.platform == RuntimePlatform.PSP2)
{
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(PSVitaKey.L));
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(PSVitaKey.R));
controllers[0].ColletAllKey();
}
#endif
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(KeyCode.Escape));
//TODO 待补全
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(PC_XBOXKEY.L));
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(PC_XBOXKEY.R));
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.HOME));
controllers[0].ColletAllKey();
}
}
public class GamingSingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 47f6f518d357c334c802a7aac4d507dc

View File

@ -1,88 +0,0 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Settings;
using System;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class MasterSystemMultiKeysSetting : MultiKeysSettingBase
{
public MasterSystemMultiKeysSetting()
{
controllers = new MasterSystemSingleKeysSeting[4];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new MasterSystemSingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_1, AxiInputEx.ByKeyCode(PSVitaKey.Start));
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_2, AxiInputEx.ByKeyCode(PSVitaKey.Select));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(PSVitaKey.Block));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(PSVitaKey.Triangle));
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
controllers[0].ColletAllKey();
return;
#endif
#region P1
//P1 键盘
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Return));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.RightShift));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.S));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.A));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.D));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.J));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.K));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.U));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.I));
//P1 UGUI
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.Delete));
controllers[1].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.UpArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.DownArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.LeftArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.RightArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.Keypad1));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.Keypad2));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.Keypad3));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.Keypad4));
controllers[0].ColletAllKey();
#endregion
}
}
public class MasterSystemSingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: e3d5584a82b098141bf0c415938daf84

View File

@ -1,80 +0,0 @@
using AxibugEmuOnline.Client.Manager;
using AxiInputSP;
using UnityEngine;
using VirtualNes.Core;
namespace AxiInputSP.Setting
{
public class NESMultiKeysSetting : MultiKeysSettingBase
{
public NESMultiKeysSetting()
{
controllers = new NESSingleKeysSeting[4];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new NESSingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
//PSV 摇杆
controllers[0].SetKey((ulong)EnumButtonType.START, AxiInputEx.ByKeyCode(PSVitaKey.Start));
controllers[0].SetKey((ulong)EnumButtonType.SELECT, AxiInputEx.ByKeyCode(PSVitaKey.Select));
controllers[0].SetKey((ulong)EnumButtonType.UP, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)EnumButtonType.DOWN, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)EnumButtonType.LEFT, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)EnumButtonType.RIGHT, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)EnumButtonType.A, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)EnumButtonType.B, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
controllers[0].SetKey((ulong)EnumButtonType.MIC, AxiInputEx.ByKeyCode(PSVitaKey.Block));
//PSV 摇杆
controllers[0].SetKey((ulong)EnumButtonType.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)EnumButtonType.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)EnumButtonType.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)EnumButtonType.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
controllers[0].ColletAllKey();
return;
#endif
#region P1
//P1 键盘
controllers[0].SetKey((ulong)EnumButtonType.START, AxiInputEx.ByKeyCode(KeyCode.Return));
controllers[0].SetKey((ulong)EnumButtonType.SELECT, AxiInputEx.ByKeyCode(KeyCode.RightShift));
controllers[0].SetKey((ulong)EnumButtonType.UP, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)EnumButtonType.DOWN, AxiInputEx.ByKeyCode(KeyCode.S));
controllers[0].SetKey((ulong)EnumButtonType.LEFT, AxiInputEx.ByKeyCode(KeyCode.A));
controllers[0].SetKey((ulong)EnumButtonType.RIGHT, AxiInputEx.ByKeyCode(KeyCode.D));
controllers[0].SetKey((ulong)EnumButtonType.A, AxiInputEx.ByKeyCode(KeyCode.K));
controllers[0].SetKey((ulong)EnumButtonType.B, AxiInputEx.ByKeyCode(KeyCode.J));
controllers[0].SetKey((ulong)EnumButtonType.MIC, AxiInputEx.ByKeyCode(KeyCode.U));
//P1 UGUI
controllers[0].SetKey((ulong)EnumButtonType.START, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_1));
controllers[0].SetKey((ulong)EnumButtonType.SELECT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_2));
controllers[0].SetKey((ulong)EnumButtonType.UP, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)EnumButtonType.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EnumButtonType.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EnumButtonType.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EnumButtonType.A, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EnumButtonType.B, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EnumButtonType.MIC, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
//P2 键盘
controllers[1].SetKey((ulong)EnumButtonType.START, AxiInputEx.ByKeyCode(KeyCode.Keypad0));
controllers[1].SetKey((ulong)EnumButtonType.SELECT, AxiInputEx.ByKeyCode(KeyCode.Delete));
controllers[1].SetKey((ulong)EnumButtonType.UP, AxiInputEx.ByKeyCode(KeyCode.UpArrow));
controllers[1].SetKey((ulong)EnumButtonType.DOWN, AxiInputEx.ByKeyCode(KeyCode.DownArrow));
controllers[1].SetKey((ulong)EnumButtonType.LEFT, AxiInputEx.ByKeyCode(KeyCode.LeftArrow));
controllers[1].SetKey((ulong)EnumButtonType.RIGHT, AxiInputEx.ByKeyCode(KeyCode.RightArrow));
controllers[1].SetKey((ulong)EnumButtonType.A, AxiInputEx.ByKeyCode(KeyCode.Keypad2));
controllers[1].SetKey((ulong)EnumButtonType.B, AxiInputEx.ByKeyCode(KeyCode.Keypad1));
controllers[1].SetKey((ulong)EnumButtonType.MIC, AxiInputEx.ByKeyCode(KeyCode.Keypad4));
controllers[0].ColletAllKey();
#endregion
}
}
public class NESSingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 6556ff70f8cab73438e5fb7755808a3c

View File

@ -1,86 +0,0 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Settings;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class SC3000MultiKeysSetting : MultiKeysSettingBase
{
public SC3000MultiKeysSetting()
{
controllers = new SC3000SingleKeysSeting[4];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new SC3000SingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_1, AxiInputEx.ByKeyCode(PSVitaKey.Start));
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_2, AxiInputEx.ByKeyCode(PSVitaKey.Select));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(PSVitaKey.Block));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(PSVitaKey.Triangle));
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
controllers[0].ColletAllKey();
return;
#endif
#region P1
//P1 键盘
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Return));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.RightShift));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.S));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.A));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.D));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.J));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.K));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.U));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.I));
//P1 UGUI
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.Delete));
controllers[1].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.UpArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.DownArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.LeftArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.RightArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.Keypad1));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.Keypad2));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.Keypad3));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.Keypad4));
controllers[0].ColletAllKey();
#endregion
}
}
public class SC3000SingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: bee2b8a3f5efaec47b9b363eeaa03160

View File

@ -1,86 +0,0 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Settings;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class SG1000MultiKeysSetting : MultiKeysSettingBase
{
public SG1000MultiKeysSetting()
{
controllers = new SG1000SingleKeysSeting[4];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new SG1000SingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_1, AxiInputEx.ByKeyCode(PSVitaKey.Start));
controllers[0].SetKey((ulong)EssgeeSingleKey.POTION_2, AxiInputEx.ByKeyCode(PSVitaKey.Select));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(PSVitaKey.Block));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(PSVitaKey.Triangle));
//PSV 摇杆
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
controllers[0].ColletAllKey();
return;
#endif
#region P1
//P1 键盘
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Return));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.RightShift));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.S));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.A));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.D));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.J));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.K));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.U));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.I));
//P1 UGUI
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_1));
controllers[0].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_2));
controllers[0].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
//P2 键盘
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_1, AxiInputEx.ByKeyCode(KeyCode.Keypad0));
controllers[1].SetKey((ulong)EssgeeSingleKey.OPTION_2, AxiInputEx.ByKeyCode(KeyCode.Delete));
controllers[1].SetKey((ulong)EssgeeSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.UpArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.DownArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.LeftArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.RightArrow));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_1, AxiInputEx.ByKeyCode(KeyCode.Keypad1));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_2, AxiInputEx.ByKeyCode(KeyCode.Keypad2));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_3, AxiInputEx.ByKeyCode(KeyCode.Keypad3));
controllers[1].SetKey((ulong)EssgeeSingleKey.BTN_4, AxiInputEx.ByKeyCode(KeyCode.Keypad4));
controllers[0].ColletAllKey();
#endregion
}
}
public class SG1000SingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 771225d8fe367ac42b6b91adf81ca27f

View File

@ -1,83 +0,0 @@
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Settings;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class UMAMEMultiKeysSetting : MultiKeysSettingBase
{
public UMAMEMultiKeysSetting()
{
controllers = new UMAMEKSingleKeysSeting[4];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new UMAMEKSingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
//PSV 摇杆
controllers[0].SetKey((ulong)MAMEKSingleKey.GAMESTART, AxiInputEx.ByKeyCode(PSVitaKey.Start));
controllers[0].SetKey((ulong)MAMEKSingleKey.INSERT_COIN, AxiInputEx.ByKeyCode(PSVitaKey.Select));
controllers[0].SetKey((ulong)MAMEKSingleKey.UP, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)MAMEKSingleKey.DOWN, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)MAMEKSingleKey.LEFT, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)MAMEKSingleKey.RIGHT, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)MAMEKSingleKey.BTN_A, AxiInputEx.ByKeyCode(PSVitaKey.Block));
controllers[0].SetKey((ulong)MAMEKSingleKey.BTN_B, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)MAMEKSingleKey.BTN_C, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
controllers[0].SetKey((ulong)MAMEKSingleKey.BTN_D, AxiInputEx.ByKeyCode(PSVitaKey.Triangle));
controllers[0].SetKey((ulong)MAMEKSingleKey.BTN_E, AxiInputEx.ByKeyCode(PSVitaKey.L));
controllers[0].SetKey((ulong)MAMEKSingleKey.BTN_F, AxiInputEx.ByKeyCode(PSVitaKey.R));
//PSV 摇杆
controllers[0].SetKey((ulong)MAMEKSingleKey.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)MAMEKSingleKey.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)MAMEKSingleKey.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)MAMEKSingleKey.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
controllers[0].ColletAllKey();
return;
#endif
#region P1
//P1 键盘
controllers[0].SetKey((ulong)UMAMEKSingleKey.GAMESTART, AxiInputEx.ByKeyCode(KeyCode.Alpha1));
controllers[0].SetKey((ulong)UMAMEKSingleKey.INSERT_COIN, AxiInputEx.ByKeyCode(KeyCode.Alpha5));
controllers[0].SetKey((ulong)UMAMEKSingleKey.UP, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)UMAMEKSingleKey.DOWN, AxiInputEx.ByKeyCode(KeyCode.S));
controllers[0].SetKey((ulong)UMAMEKSingleKey.LEFT, AxiInputEx.ByKeyCode(KeyCode.A));
controllers[0].SetKey((ulong)UMAMEKSingleKey.RIGHT, AxiInputEx.ByKeyCode(KeyCode.D));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_A, AxiInputEx.ByKeyCode(KeyCode.J));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_B, AxiInputEx.ByKeyCode(KeyCode.K));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_C, AxiInputEx.ByKeyCode(KeyCode.L));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_D, AxiInputEx.ByKeyCode(KeyCode.U));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_E, AxiInputEx.ByKeyCode(KeyCode.I));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_F, AxiInputEx.ByKeyCode(KeyCode.O));
//Axis
controllers[0].SetKey((ulong)UMAMEKSingleKey.UP, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)UMAMEKSingleKey.DOWN, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)UMAMEKSingleKey.LEFT, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)UMAMEKSingleKey.RIGHT, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
//P1 UGUI
controllers[0].SetKey((ulong)UMAMEKSingleKey.GAMESTART, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_1));
controllers[0].SetKey((ulong)UMAMEKSingleKey.INSERT_COIN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.POTION_2));
controllers[0].SetKey((ulong)UMAMEKSingleKey.UP, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)UMAMEKSingleKey.DOWN, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)UMAMEKSingleKey.LEFT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)UMAMEKSingleKey.RIGHT, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_A, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_B, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_C, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_C));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_D, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_D));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_E, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_E));
controllers[0].SetKey((ulong)UMAMEKSingleKey.BTN_F, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_F));
controllers[0].ColletAllKey();
#endregion
}
}
public class UMAMEKSingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 486aed2afcba6b94f86c1ae4e4aeaf02

View File

@ -1,72 +0,0 @@
using AxibugEmuOnline.Client;
using AxibugEmuOnline.Client.Common;
using AxibugEmuOnline.Client.Manager;
using UnityEngine;
namespace AxiInputSP.Setting
{
public class XMBMultiKeysSetting : MultiKeysSettingBase
{
public XMBMultiKeysSetting()
{
controllers = new XMBSingleKeysSeting[1];
for (int i = 0; i < controllers.Length; i++)
controllers[i] = new XMBSingleKeysSeting();
}
public override void LoadDefaultSetting()
{
ClearAll();
#if UNITY_PSP2 && !UNITY_EDITOR
controllers[0].SetKey((ulong)EnumCommand.SelectItemUp, AxiInputEx.ByKeyCode(PSVitaKey.Up));
controllers[0].SetKey((ulong)EnumCommand.SelectItemDown, AxiInputEx.ByKeyCode(PSVitaKey.Down));
controllers[0].SetKey((ulong)EnumCommand.SelectItemLeft, AxiInputEx.ByKeyCode(PSVitaKey.Left));
controllers[0].SetKey((ulong)EnumCommand.SelectItemRight, AxiInputEx.ByKeyCode(PSVitaKey.Right));
controllers[0].SetKey((ulong)EnumCommand.Enter, AxiInputEx.ByKeyCode(PSVitaKey.Circle));
controllers[0].SetKey((ulong)EnumCommand.Back, AxiInputEx.ByKeyCode(PSVitaKey.Cross));
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(PSVitaKey.Triangle));
controllers[0].ColletAllKey();
return;
#endif
//键盘
controllers[0].SetKey((ulong)EnumCommand.SelectItemUp, AxiInputEx.ByKeyCode(KeyCode.W));
controllers[0].SetKey((ulong)EnumCommand.SelectItemDown, AxiInputEx.ByKeyCode(KeyCode.S));
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.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
controllers[0].SetKey((ulong)EnumCommand.SelectItemUp, AxiInputEx.ByAxis(AxiInputAxisType.UP));
controllers[0].SetKey((ulong)EnumCommand.SelectItemDown, AxiInputEx.ByAxis(AxiInputAxisType.DOWN));
controllers[0].SetKey((ulong)EnumCommand.SelectItemLeft, AxiInputEx.ByAxis(AxiInputAxisType.LEFT));
controllers[0].SetKey((ulong)EnumCommand.SelectItemRight, AxiInputEx.ByAxis(AxiInputAxisType.RIGHT));
//P1 UGUI
controllers[0].SetKey((ulong)EnumCommand.SelectItemUp, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.UP));
controllers[0].SetKey((ulong)EnumCommand.SelectItemDown, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.DOWN));
controllers[0].SetKey((ulong)EnumCommand.SelectItemLeft, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.LEFT));
controllers[0].SetKey((ulong)EnumCommand.SelectItemRight, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.RIGHT));
controllers[0].SetKey((ulong)EnumCommand.Enter, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_A));
controllers[0].SetKey((ulong)EnumCommand.Back, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.BTN_B));
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByUGUIBtn(AxiInputUGuiBtnType.HOME));
//PC XBOX
//TODO 待补全
controllers[0].SetKey((ulong)EnumCommand.Enter, AxiInputEx.ByKeyCode(PC_XBOXKEY.MenuBtn));
controllers[0].SetKey((ulong)EnumCommand.Back, AxiInputEx.ByKeyCode(PC_XBOXKEY.ViewBtn));
controllers[0].SetKey((ulong)EnumCommand.OptionMenu, AxiInputEx.ByKeyCode(PC_XBOXKEY.Y));
controllers[0].ColletAllKey();
}
}
public class XMBSingleKeysSeting : SingleKeySettingBase
{
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 90bd1ccb53a0ddd4b814030f1ae218a2

View File

@ -46,10 +46,10 @@ namespace AxiInputSP
BTN_D,
BTN_E,
BTN_F,
POTION_1,
POTION_2,
POTION_3,
POTION_4,
OPTION_1,
OPTION_2,
OPTION_3,
OPTION_4,
HOME,
}
}

View File

@ -1,79 +0,0 @@
using AxiInputSP.Axis;
using AxiInputSP.UGUI;
using UnityEngine;
namespace AxiInputSP
{
public static class AxiInputEx
{
public static AxiInput ByKeyCode(KeyCode keycode)
{
AxiInput data = new AxiInput();
data.all = 0;
data.type = AxiInputType.UNITY_KEYCODE;
data.KeyCodeValue = keycode;
return data;
}
public static AxiInput ByAxis(AxiInputAxisType axisType)
{
AxiInput data = new AxiInput();
data.all = 0;
data.type = AxiInputType.UNITY_AXIS;
data.AxisType = axisType;
return data;
}
public static AxiInput ByUGUIBtn(AxiInputUGuiBtnType btnType)
{
AxiInput data = new AxiInput();
data.all = 0;
data.type = AxiInputType.UNITY_UGUI_BTN;
data.UguiBtn = btnType;
return data;
}
public static bool GetKeyDown(this AxiInput axiInput)
{
switch (axiInput.type)
{
case AxiInputType.UNITY_KEYCODE:
return Input.GetKeyDown(axiInput.KeyCodeValue);
case AxiInputType.UNITY_AXIS:
return AxiInputAxisCenter.GetKeyDown(axiInput.AxisType);
case AxiInputType.UNITY_UGUI_BTN:
return AxiInputUGUICenter.GetKeyDown(axiInput.UguiBtn);
default:
return false;
}
}
public static bool GetKeyUp(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;
}
}
public static bool GetKey(this AxiInput axiInput)
{
switch (axiInput.type)
{
case AxiInputType.UNITY_KEYCODE:
return Input.GetKey(axiInput.KeyCodeValue);
case AxiInputType.UNITY_AXIS:
return AxiInputAxisCenter.GetKey(axiInput.AxisType);
case AxiInputType.UNITY_UGUI_BTN:
return AxiInputUGUICenter.GetKey(axiInput.UguiBtn);
default:
return false;
}
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: f19df5371f3222747868da94fc86702f

View File

@ -1,78 +0,0 @@
using System.Collections.Generic;
namespace AxiInputSP.UGUI
{
public static class AxiInputUGUICenter
{
static int handleSeed = 0;
static Dictionary<int, AxiInputUGUIHandle> dictHandle2AxiUgui = new Dictionary<int, AxiInputUGUIHandle>();
static Dictionary<AxiInputUGuiBtnType, List<AxiInputUGUIHandle>> dictBtnType2BtnList = new Dictionary<AxiInputUGuiBtnType, List<AxiInputUGUIHandle>>();
public static int GetNextSeed()
{
return ++handleSeed;
}
public static void RegHandle(AxiInputUGUIHandle uiHandle)
{
dictHandle2AxiUgui[uiHandle.Handle] = uiHandle;
List<AxiInputUGUIHandle> list;
if (!dictBtnType2BtnList.TryGetValue(uiHandle.UguiBtnType, out list))
list = dictBtnType2BtnList[uiHandle.UguiBtnType] = new List<AxiInputUGUIHandle>();
if (!list.Contains(uiHandle))
list.Add(uiHandle);
}
public static void UnregHandle(AxiInputUGUIHandle uiHandle)
{
if (!dictHandle2AxiUgui.ContainsKey(uiHandle.Handle))
return;
dictHandle2AxiUgui.Remove(uiHandle.Handle);
List<AxiInputUGUIHandle> list;
if (dictBtnType2BtnList.TryGetValue(uiHandle.UguiBtnType, out list))
{
if (list.Contains(uiHandle))
list.Remove(uiHandle);
}
}
public static bool GetKeyUp(AxiInputUGuiBtnType btntype)
{
List<AxiInputUGUIHandle> list;
if (!dictBtnType2BtnList.TryGetValue(btntype, out list))
return false;
for (int i = 0; i < list.Count; i++)
{
if (list[i].GetKeyUp())
return true;
}
return false;
}
public static bool GetKeyDown(AxiInputUGuiBtnType btntype)
{
List<AxiInputUGUIHandle> list;
if (!dictBtnType2BtnList.TryGetValue(btntype, out list))
return false;
for (int i = 0; i < list.Count; i++)
{
if (list[i].GetKeyDown())
return true;
}
return false;
}
public static bool GetKey(AxiInputUGuiBtnType btntype)
{
List<AxiInputUGUIHandle> 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;
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: e41586af52faf33488c59e2608f9ff7b

View File

@ -1,40 +0,0 @@
using System;
namespace AxiInputSP.UGUI
{
public class AxiInputUGUIHandle
{
public int Handle { get; private set; }
public AxiInputUGuiBtnType UguiBtnType { get; private set; }
public AxiInputUGUIHandle(AxiInputUGuiBtnType uguiBtnType)
{
Handle = AxiInputUGUICenter.GetNextSeed();
this.UguiBtnType = uguiBtnType;
AxiInputUGUICenter.RegHandle(this);
}
public bool GetKey()
{
return GetKeyHandle != null ? GetKeyHandle.Invoke() : false;
}
public bool GetKeyUp()
{
return GetKeyUpHandle != null ? GetKeyUpHandle.Invoke() : false;
}
public bool GetKeyDown()
{
return GetKeyDownHandle != null ? GetKeyDownHandle.Invoke() : false;
}
public Func<bool> GetKeyHandle;
public Func<bool> GetKeyUpHandle;
public Func<bool> GetKeyDownHandle;
public void Dispose()
{
GetKeyHandle = null;
GetKeyUpHandle = null;
GetKeyDownHandle = null;
AxiInputUGUICenter.UnregHandle(this);
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: e4ca40659ca235846b10ee28305147dd

View File

@ -13,59 +13,22 @@ namespace AxiInputSP.UGUI
KeyHold
}
AxiInputUGUIHandle[] handles;
AxiButtonState m_state = AxiButtonState.None;
/// <summary>
/// 键值(支持组合键)
/// </summary>
[SerializeField]
public AxiInputUGuiBtnType[] axiBtnTypeList;
protected override void Awake()
{
base.Awake();
if (axiBtnTypeList != null)
{
handles = new AxiInputUGUIHandle[axiBtnTypeList.Length];
for (int i = 0; i < axiBtnTypeList.Length; i++)
{
handles[i] = new AxiInputUGUIHandle(axiBtnTypeList[i]);
handles[i].GetKeyHandle = GetKey;
handles[i].GetKeyUpHandle = GetKeyUp;
handles[i].GetKeyDownHandle = GetKeyDown;
}
}
}
protected override void OnDestroy()
{
base.OnDestroy();
if (axiBtnTypeList != null)
{
handles = new AxiInputUGUIHandle[axiBtnTypeList.Length];
for (int i = 0; i < axiBtnTypeList.Length; i++)
{
handles[i].Dispose();
handles[i] = null;
}
axiBtnTypeList = null;
handles = null;
}
}
protected override void OnEnable()
{
base.OnEnable();
}
bool GetKey()
public bool GetKey()
{
return m_state >= AxiButtonState.KeyDown;
}
bool GetKeyUp()
public bool GetKeyUp()
{
return m_state == AxiButtonState.KeyUp;
}
bool GetKeyDown()
public bool GetKeyDown()
{
return m_state == AxiButtonState.KeyDown;
}

View File

@ -1,121 +0,0 @@
using System;
using System.Collections.Generic;
using UnityEngine;
namespace AxiInputSP.UGUI
{
public class AxiIptJoystick : IDisposable
{
enum AxiIptJoystickState
{
None,
KeyUp,
KeyDown,
KeyHold
}
static long LastCheckFrame = -1;
static Func<Vector2Int> RawJoy;
AxiInputUGUIHandle[] handles = new AxiInputUGUIHandle[4];
static Dictionary<AxiInputUGuiBtnType, AxiIptJoystickState> mAxis2State = new Dictionary<AxiInputUGuiBtnType, AxiIptJoystickState>();
public AxiIptJoystick(Func<Vector2Int> getRawJoy)
{
RawJoy = getRawJoy;
handles[0] = new AxiInputUGUIHandle(AxiInputUGuiBtnType.UP);
handles[0].GetKeyHandle = (() => { return GetKey(AxiInputUGuiBtnType.UP); });
handles[0].GetKeyUpHandle = (() => { return GetKeyUp(AxiInputUGuiBtnType.UP); });
handles[0].GetKeyDownHandle = (() => { return GetKeyDown(AxiInputUGuiBtnType.UP); });
mAxis2State[AxiInputUGuiBtnType.UP] = AxiIptJoystickState.None;
handles[1] = new AxiInputUGUIHandle(AxiInputUGuiBtnType.DOWN);
handles[1].GetKeyHandle = (() => { return GetKey(AxiInputUGuiBtnType.DOWN); });
handles[1].GetKeyUpHandle = (() => { return GetKeyUp(AxiInputUGuiBtnType.DOWN); });
handles[1].GetKeyDownHandle = (() => { return GetKeyDown(AxiInputUGuiBtnType.DOWN); });
mAxis2State[AxiInputUGuiBtnType.DOWN] = AxiIptJoystickState.None;
handles[2] = new AxiInputUGUIHandle(AxiInputUGuiBtnType.LEFT);
handles[2].GetKeyHandle = (() => { return GetKey(AxiInputUGuiBtnType.LEFT); });
handles[2].GetKeyUpHandle = (() => { return GetKeyUp(AxiInputUGuiBtnType.LEFT); });
handles[2].GetKeyDownHandle = (() => { return GetKeyDown(AxiInputUGuiBtnType.LEFT); });
mAxis2State[AxiInputUGuiBtnType.LEFT] = AxiIptJoystickState.None;
handles[3] = new AxiInputUGUIHandle(AxiInputUGuiBtnType.RIGHT);
handles[3].GetKeyHandle = (() => { return GetKey(AxiInputUGuiBtnType.RIGHT); });
handles[3].GetKeyUpHandle = (() => { return GetKeyUp(AxiInputUGuiBtnType.RIGHT); });
handles[3].GetKeyDownHandle = (() => { return GetKeyDown(AxiInputUGuiBtnType.RIGHT); });
mAxis2State[AxiInputUGuiBtnType.RIGHT] = AxiIptJoystickState.None;
}
public void Dispose()
{
for (int i = 0; i < handles.Length; i++)
{
handles[i].Dispose();
handles[i] = null;
}
mAxis2State.Clear();
}
public static void UpdateState()
{
if (LastCheckFrame == Time.frameCount)
return;
LastCheckFrame = Time.frameCount;
RecheckSingleState(AxiInputUGuiBtnType.RIGHT);
RecheckSingleState(AxiInputUGuiBtnType.LEFT);
RecheckSingleState(AxiInputUGuiBtnType.UP);
RecheckSingleState(AxiInputUGuiBtnType.DOWN);
}
static void RecheckSingleState(AxiInputUGuiBtnType axisType)
{
bool bKey = false;
Vector2Int inputV2 = RawJoy.Invoke();
switch (axisType)
{
case AxiInputUGuiBtnType.RIGHT: bKey = inputV2.x > 0; break;
case AxiInputUGuiBtnType.LEFT: bKey = inputV2.x < 0; break;
case AxiInputUGuiBtnType.UP: bKey = inputV2.y > 0; break;
case AxiInputUGuiBtnType.DOWN: bKey = inputV2.y < 0; break;
}
//按下
if (bKey)
{
//如果之前帧是KeyUp或None则为KeyDown|KeyHold
if (mAxis2State[axisType] <= AxiIptJoystickState.KeyUp)
mAxis2State[axisType] = AxiIptJoystickState.KeyDown;
//如果之前帧是KeyDown则为KeyHold
else if (mAxis2State[axisType] == AxiIptJoystickState.KeyDown)
mAxis2State[axisType] = AxiIptJoystickState.KeyHold;
}
//未按下
else
{
//如果之前帧是KeyDown|KeyHold则为KeyUp|None
if (mAxis2State[axisType] >= AxiIptJoystickState.KeyDown)
mAxis2State[axisType] = AxiIptJoystickState.KeyUp;
//如果之前帧是KeyUp则为None
else if (mAxis2State[axisType] == AxiIptJoystickState.KeyUp)
mAxis2State[axisType] = AxiIptJoystickState.None;
}
}
bool GetKey(AxiInputUGuiBtnType key)
{
UpdateState();
return mAxis2State[key] >= AxiIptJoystickState.KeyDown;
}
bool GetKeyUp(AxiInputUGuiBtnType key)
{
UpdateState();
return mAxis2State[key] == AxiIptJoystickState.KeyUp;
}
bool GetKeyDown(AxiInputUGuiBtnType key)
{
UpdateState();
return mAxis2State[key] == AxiIptJoystickState.KeyDown;
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 7194bc2da3bcaa747b87428fb3175009

View File

@ -0,0 +1,62 @@
using System.Collections.Generic;
using UnityEngine;
namespace AxiInputSP.UGUI
{
public class AxiScreenGamepad : MonoBehaviour
{
public delegate void OnAxiScreenGamepadActiveHandle(AxiScreenGamepad sender);
public delegate void OnAxiScreenGamepadDisactiveHandle(AxiScreenGamepad sender);
public static event OnAxiScreenGamepadActiveHandle OnGamepadActive;
public static event OnAxiScreenGamepadActiveHandle OnGamepadDisactive;
AxiIptButton[] m_buttons;
FloatingJoystick m_joystick;
HashSet<AxiInputUGuiBtnType> m_pressBtns = new HashSet<AxiInputUGuiBtnType>();
Vector2 m_joyStickRaw;
public bool GetKey(AxiInputUGuiBtnType btnType)
{
return m_pressBtns.Contains(btnType);
}
public Vector2 GetJoystickValue()
{
return m_joyStickRaw;
}
private void Update()
{
m_joyStickRaw = m_joystick.GetJoyRaw();
m_pressBtns.Clear();
foreach (var btn in m_buttons)
{
if (btn.GetKey())
{
foreach (var btnType in btn.axiBtnTypeList)
m_pressBtns.Add(btnType);
}
}
}
private void Awake()
{
m_buttons = GetComponentsInChildren<AxiIptButton>(true);
m_joystick = GetComponentInChildren<FloatingJoystick>(true);
}
private void OnEnable()
{
m_joyStickRaw = Vector2.zero;
m_pressBtns.Clear();
OnGamepadActive?.Invoke(this);
}
private void OnDisable()
{
OnGamepadDisactive?.Invoke(this);
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1c6e60f499349d7479c565da795cde9b

View File

@ -1,9 +1,7 @@
using AxibugEmuOnline.Client;
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Event;
using AxibugEmuOnline.Client.Manager;
using AxibugEmuOnline.Client.Settings;
using AxiInputSP.Setting;
using AxiReplay;
using System;
using System.Collections.Generic;

View File

@ -2,7 +2,6 @@
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.Event;
using AxibugEmuOnline.Client.Settings;
using AxiInputSP.Setting;
using AxiReplay;
using MAME.Core;
using System;

View File

@ -1,179 +0,0 @@
using AxibugEmuOnline.Client.Common;
using AxiInputSP;
using AxiInputSP.Setting;
using System;
using System.Collections.Generic;
using System.Linq;
namespace AxibugEmuOnline.Client.Manager
{
public class AppInput
{
public XMBMultiKeysSetting xmb;
public GamingMultiKeysSetting gaming;
public UMAMEMultiKeysSetting mame;
public NESMultiKeysSetting nes;
public MasterSystemMultiKeysSetting sms;
public ColecoVisionMultiKeysSetting cv;
public GameBoyColorMultiKeysSetting gbc;
public GameBoyMultiKeysSetting gb;
public GameGearMultiKeysSetting gg;
public SC3000MultiKeysSetting sc3000;
public SG1000MultiKeysSetting sg1000;
public AppInput()
{
xmb = new XMBMultiKeysSetting();
gaming = new GamingMultiKeysSetting();
mame = new UMAMEMultiKeysSetting();
nes = new NESMultiKeysSetting();
sms = new MasterSystemMultiKeysSetting();
cv = new ColecoVisionMultiKeysSetting();
gbc = new GameBoyColorMultiKeysSetting();
gb = new GameBoyMultiKeysSetting();
gg = new GameGearMultiKeysSetting();
sc3000 = new SC3000MultiKeysSetting();
sg1000 = new SG1000MultiKeysSetting();
LoadDefaultSetting();
}
public void LoadDefaultSetting()
{
xmb.LoadDefaultSetting();
gaming.LoadDefaultSetting();
mame.LoadDefaultSetting();
nes.LoadDefaultSetting();
sms.LoadDefaultSetting();
cv.LoadDefaultSetting();
gbc.LoadDefaultSetting();
gb.LoadDefaultSetting();
gg.LoadDefaultSetting();
sc3000.LoadDefaultSetting();
sg1000.LoadDefaultSetting();
}
}
public interface MultiKeysSetting
{
bool HadAnyKeyDown(int index);
void ClearAll();
void LoadDefaultSetting();
}
public interface SingleKeysSetting
{
void ClearAll();
void SetKey(ulong Key, AxiInput input);
bool GetKey(ulong Key);
bool GetKeyDown(ulong Key);
bool GetKeyUp(ulong Key);
void ColletAllKey();
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();
}
}
}

View File

@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 5c0bc1cf4f411aa4da3ffa218db2c2aa

View File

@ -20,7 +20,7 @@ namespace AxibugEmuOnline.Client.Settings
OPTION_2 = 1 << 9,
}
public abstract class EssgeeKeyBinding : EmuCoreControllerKeyBinding<EssgeeSingleKey>
public abstract class EssgeeKeyBinding : EmuCoreBinder<EssgeeSingleKey>
{
public override void Bind(Keyboard_D device, ControllerBinder controller)
{
@ -129,6 +129,24 @@ namespace AxibugEmuOnline.Client.Settings
controller.SetBinding(EssgeeSingleKey.LEFT, device.LeftStick.Left, 1);
controller.SetBinding(EssgeeSingleKey.RIGHT, device.LeftStick.Right, 1);
}
public override void Bind(ScreenGamepad_D device, ControllerBinder controller)
{
controller.SetBinding(EssgeeSingleKey.OPTION_1, device.OPTION_1, 0);
controller.SetBinding(EssgeeSingleKey.OPTION_2, device.OPTION_2, 0);
controller.SetBinding(EssgeeSingleKey.UP, device.UP, 0);
controller.SetBinding(EssgeeSingleKey.DOWN, device.DOWN, 0);
controller.SetBinding(EssgeeSingleKey.LEFT, device.LEFT, 0);
controller.SetBinding(EssgeeSingleKey.RIGHT, device.RIGHT, 0);
controller.SetBinding(EssgeeSingleKey.BTN_1, device.BTN_A, 0);
controller.SetBinding(EssgeeSingleKey.BTN_2, device.BTN_B, 0);
controller.SetBinding(EssgeeSingleKey.BTN_3, device.BTN_C, 0);
controller.SetBinding(EssgeeSingleKey.BTN_4, device.BTN_D, 0);
controller.SetBinding(EssgeeSingleKey.UP, device.JOYSTICK.Up, 1);
controller.SetBinding(EssgeeSingleKey.DOWN, device.JOYSTICK.Down, 1);
controller.SetBinding(EssgeeSingleKey.LEFT, device.JOYSTICK.Left, 1);
controller.SetBinding(EssgeeSingleKey.RIGHT, device.JOYSTICK.Right, 1);
}
}
public class MasterSystemKeyBinding : EssgeeKeyBinding

View File

@ -1,17 +0,0 @@
using AxibugEmuOnline.Client.InputDevices;
using System;
namespace AxibugEmuOnline.Client.Settings
{
/// <summary>
/// 在所有<see cref="EmuCoreControllerKeyBinding{T}"/>的派生类中实现此接口以支持一种设备的绑定
/// <para>一种<see cref="EmuCoreControllerKeyBinding{T}"/>
/// 一个<see cref="EmuCoreControllerKeyBinding{T}.ControllerBinder"/>可以与多种设备建立绑定,但设备类型不可重复</para>
/// </summary>
public interface IDeviceBinder<ENUM, DEVICE>
where ENUM : Enum
where DEVICE : InputDevice_D
{
void Bind(DEVICE device, EmuCoreControllerKeyBinding<ENUM>.ControllerBinder controller);
}
}

View File

@ -1,10 +1,6 @@
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.InputDevices;
using AxibugProtobuf;
using AxibugProtobuf;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace AxibugEmuOnline.Client.Settings
{
@ -13,321 +9,32 @@ namespace AxibugEmuOnline.Client.Settings
/// </summary>
public class KeyMapperSetting
{
Dictionary<RomPlatformType, EmuCoreControllerKeyBinding> m_binders = new Dictionary<RomPlatformType, EmuCoreControllerKeyBinding>();
Dictionary<Type, EmuCoreControllerKeyBinding> m_bindersByType = new Dictionary<Type, EmuCoreControllerKeyBinding>();
Dictionary<RomPlatformType, InternalEmuCoreBinder> m_binders = new Dictionary<RomPlatformType, InternalEmuCoreBinder>();
Dictionary<Type, InternalEmuCoreBinder> m_bindersByType = new Dictionary<Type, InternalEmuCoreBinder>();
public KeyMapperSetting()
{
var baseType = typeof(EmuCoreControllerKeyBinding);
var baseType = typeof(InternalEmuCoreBinder);
foreach (var t in baseType.Assembly.ExportedTypes)
{
if (t.IsAbstract) continue;
if (!baseType.IsAssignableFrom(t)) continue;
var binderIns = Activator.CreateInstance(t) as EmuCoreControllerKeyBinding;
var binderIns = Activator.CreateInstance(t) as InternalEmuCoreBinder;
m_binders.Add(binderIns.Platform, binderIns);
m_bindersByType.Add(binderIns.GetType(), binderIns);
}
}
public T GetBinder<T>() where T : EmuCoreControllerKeyBinding
public T GetBinder<T>() where T : InternalEmuCoreBinder
{
m_bindersByType.TryGetValue(typeof(T), out var binder);
return binder as T;
}
public T GetBinder<T>(RomPlatformType romType) where T : EmuCoreControllerKeyBinding
public T GetBinder<T>(RomPlatformType romType) where T : InternalEmuCoreBinder
{
m_binders.TryGetValue(romType, out var binder);
return binder as T;
}
}
/// <summary>
/// 此类为内部继承, 请勿继承此类
/// </summary>
public abstract class EmuCoreControllerKeyBinding
{
/// <summary> 所属核心 </summary>
public abstract RomPlatformType Platform { get; }
/// <summary> 控制器数量 </summary>
public abstract int ControllerCount { get; }
}
/// <summary>
/// 模拟器核心控制器键位绑定器
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class EmuCoreControllerKeyBinding<T> : EmuCoreControllerKeyBinding,
IDeviceBinder<T, Keyboard_D>,
IDeviceBinder<T, GamePad_D>,
IDeviceBinder<T, DualShockController_D>,
IDeviceBinder<T, XboxController_D>,
IDeviceBinder<T, PSVController_D>
where T : Enum
{
//每一个实例代表一个对应模拟器平台的控制器索引
List<ControllerBinder> m_bindingPages = new List<ControllerBinder>();
public EmuCoreControllerKeyBinding()
{
var types = GetType().GetInterfaces();
for (int i = 0; i < ControllerCount; i++)
{
m_bindingPages.Add(new ControllerBinder(i, this));
}
foreach (var device in App.input.GetDevices())
{
foreach (var binding in m_bindingPages)
{
binding.RegistInputDevice(device);
}
}
App.input.OnDeviceLost += InputDevicesMgr_OnDeviceLost;
App.input.OnDeviceConnected += InputDevicesMgr_OnDeviceConnected;
}
private void InputDevicesMgr_OnDeviceConnected(InputDevice_D connectDevice)
{
foreach (var binding in m_bindingPages)
{
binding.RegistInputDevice(connectDevice);
}
}
private void InputDevicesMgr_OnDeviceLost(InputDevice_D lostDevice)
{
foreach (var binding in m_bindingPages)
{
binding.UnregistInputDevice(lostDevice);
}
}
internal void RaiseDeviceRegist(InputDevice_D device, ControllerBinder binding)
{
if (device is Keyboard_D keyboard) Bind(keyboard, binding);
else if (device is GamePad_D gamePad) Bind(gamePad, binding);
else if (device is DualShockController_D dsC) Bind(dsC, binding);
else if (device is XboxController_D xbC) Bind(xbC, binding);
else if (device is PSVController_D psvC) Bind(psvC, binding);
else throw new NotImplementedException($"{device.GetType()}");
}
public bool Start(T emuControl, int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
foreach (var key in binding.GetBinding(emuControl))
{
if (key.Start) return true;
}
return false;
}
public bool Release(T emuControl, int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
foreach (var key in binding.GetBinding(emuControl))
{
if (key.Release) return true;
}
return false;
}
/// <summary>
/// 获取指定控件是否处于按下状态
/// <para>如果绑定了多个物理按键,则只有这多个物理按键全部不处于按下状态时,才会返回false</para>
/// </summary>
/// <param name="emuControl"></param>
/// <param name="controllerIndex"></param>
/// <returns></returns>
public bool GetKey(T emuControl, int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
foreach (var key in binding.GetBinding(emuControl))
{
if (key.Performing) return true;
}
return false;
}
/// <summary>
/// 获取调用帧是否有任意按键触发了按下操作
/// </summary>
/// <param name="controllerIndex"></param>
/// <returns></returns>
public bool AnyKeyDown(int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
return binding.AnyKeyDown();
}
/// <summary>
/// 获取指定控件的向量值
/// <para>通常用于摇杆类型的控件</para>
/// <para>如果同时绑定了多个物理输入设备,只会返回其中一个物理设备的向量值</para>
/// </summary>
/// <param name="emuControl">模拟器平台的具体键枚举</param>
/// <param name="controllerIndex">模拟器平台的控制器序号</param>
/// <returns></returns>
public Vector2 GetVector2(T emuControl, int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
foreach (var control in binding.GetBinding(emuControl))
{
if (!control.Performing) continue;
return control.GetVector2();
}
return default(Vector2);
}
/// <summary>
/// 获取指定控件的浮点值,取值范围为[0f,1f]
/// <para>通常用于线性类按键,例如PS手柄的扳机键</para>
/// <para>普通的按键也能读取这个值,但返回值只会有0f和1f两种值</para>
/// <para>如果同时绑定了多个物理控件,则会从所有处于按下状态的物理控件中取平均值</para>
/// </summary>
/// <param name="emuControl">模拟器平台的具体键枚举</param>
/// <param name="controllerIndex">模拟器平台的控制器序号</param>
/// <returns></returns>
public float GetFloat(T emuControl, int controllerIndex)
{
var totalFloat = 0f;
var totalControl = 0;
var binding = m_bindingPages[controllerIndex];
foreach (var key in binding.GetBinding(emuControl))
{
if (!key.Performing) continue;
totalControl++;
totalFloat += key.GetFlaot();
}
if (totalControl == 0) return default(float);
else return totalFloat / totalControl;
}
public class MapSetting : Dictionary<T, List<InputControl_C>> { }
public class ControllerBinder
{
Dictionary<Type, InputDevice_D> m_registedDevices = new Dictionary<Type, InputDevice_D>();
Dictionary<InputDevice_D, MapSetting> m_mapSetting = new Dictionary<InputDevice_D, MapSetting>();
public int ControllerIndex { get; }
public EmuCoreControllerKeyBinding<T> Host { get; }
internal ControllerBinder(int controllerIndex, EmuCoreControllerKeyBinding<T> host)
{
ControllerIndex = controllerIndex;
Host = host;
}
internal bool IsRegisted<DEVICE>() where DEVICE : InputDevice_D
{
var type = typeof(T);
return IsRegisted(type);
}
internal bool IsRegisted(Type deviceType)
{
return m_registedDevices.ContainsKey(deviceType);
}
internal void RegistInputDevice(InputDevice_D device)
{
var type = device.GetType();
if (IsRegisted(type)) return;
m_registedDevices.Add(type, device);
m_mapSetting[device] = new MapSetting();
Host.RaiseDeviceRegist(device, this);
}
internal void UnregistInputDevice(InputDevice_D device)
{
var type = device.GetType();
if (!IsRegisted(type)) return;
m_registedDevices.Remove(type);
m_mapSetting.Remove(device);
}
public void SetBinding(T emuBtn, InputControl_C key, int settingSlot)
{
var device = key.Device;
m_registedDevices.TryGetValue(device.GetType(), out var inputDevice);
Debug.Assert(inputDevice == device);
var setting = m_mapSetting[inputDevice];
if (!setting.TryGetValue(emuBtn, out var settingList))
{
settingList = new List<InputControl_C>();
setting[emuBtn] = settingList;
}
int needFixCount = settingSlot - settingList.Count + 1;
if (needFixCount > 0) for (int i = 0; i < needFixCount; i++) settingList.Add(null);
settingList[settingSlot] = key;
}
public InputControl_C GetBinding(T emuBtn, InputDevice_D device, int settingSlot)
{
m_mapSetting.TryGetValue(device, out var mapSetting);
if (mapSetting == null) return null;
mapSetting.TryGetValue(emuBtn, out var settingList);
if (settingList == null || settingSlot >= settingList.Count) return null;
return settingList[settingSlot];
}
private List<InputControl_C> m_caches = new List<InputControl_C>();
public IEnumerable<InputControl_C> GetBinding(T emuBtn)
{
m_caches.Clear();
foreach (var mapSettings in m_mapSetting.Values)
{
mapSettings.TryGetValue(emuBtn, out var bindControls);
if (bindControls != null)
{
m_caches.AddRange(bindControls);
}
}
return m_caches;
}
public bool AnyKeyDown()
{
foreach (var mapSettings in m_mapSetting.Values)
{
foreach (var keys in mapSettings.Values)
{
foreach (var key in keys)
{
if (key.Start) return true;
}
}
}
return false;
}
}
public abstract void Bind(Keyboard_D device, ControllerBinder controller);
public abstract void Bind(GamePad_D device, ControllerBinder controller);
public abstract void Bind(DualShockController_D device, ControllerBinder controller);
public abstract void Bind(XboxController_D device, ControllerBinder controller);
public abstract void Bind(PSVController_D device, ControllerBinder controller);
}
}

View File

@ -20,7 +20,7 @@ namespace AxibugEmuOnline.Client.Settings
BTN_F
}
public abstract class MAMEKeyBinding : EmuCoreControllerKeyBinding<UMAMEKSingleKey>
public abstract class MAMEKeyBinding : EmuCoreBinder<UMAMEKSingleKey>
{
public override int ControllerCount => 4;
@ -138,6 +138,26 @@ namespace AxibugEmuOnline.Client.Settings
controller.SetBinding(UMAMEKSingleKey.LEFT, device.LeftStick.Left, 1);
controller.SetBinding(UMAMEKSingleKey.RIGHT, device.LeftStick.Right, 1);
}
public override void Bind(ScreenGamepad_D device, ControllerBinder controller)
{
controller.SetBinding(UMAMEKSingleKey.INSERT_COIN, device.OPTION_1, 0);
controller.SetBinding(UMAMEKSingleKey.GAMESTART, device.OPTION_2, 0);
controller.SetBinding(UMAMEKSingleKey.UP, device.UP, 0);
controller.SetBinding(UMAMEKSingleKey.DOWN, device.DOWN, 0);
controller.SetBinding(UMAMEKSingleKey.LEFT, device.LEFT, 0);
controller.SetBinding(UMAMEKSingleKey.RIGHT, device.RIGHT, 0);
controller.SetBinding(UMAMEKSingleKey.BTN_A, device.BTN_A, 0);
controller.SetBinding(UMAMEKSingleKey.BTN_B, device.BTN_B, 0);
controller.SetBinding(UMAMEKSingleKey.BTN_C, device.BTN_C, 0);
controller.SetBinding(UMAMEKSingleKey.BTN_D, device.BTN_D, 0);
controller.SetBinding(UMAMEKSingleKey.BTN_E, device.BTN_E, 0);
controller.SetBinding(UMAMEKSingleKey.BTN_F, device.BTN_F, 0);
controller.SetBinding(UMAMEKSingleKey.UP, device.JOYSTICK.Up, 1);
controller.SetBinding(UMAMEKSingleKey.DOWN, device.JOYSTICK.Down, 1);
controller.SetBinding(UMAMEKSingleKey.LEFT, device.JOYSTICK.Left, 1);
controller.SetBinding(UMAMEKSingleKey.RIGHT, device.JOYSTICK.Right, 1);
}
}
public class NEOGEOKeyBinding : MAMEKeyBinding

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 91746af636f351140a4796dc4e98be6d
guid: d3e856501fe4be94db55b29fc9e4dfdb
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@ -0,0 +1,287 @@
using AxibugEmuOnline.Client.ClientCore;
using AxibugEmuOnline.Client.InputDevices;
using AxibugEmuOnline.Client.Settings;
using System;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 模拟器核心控制器键位绑定器
/// </summary>
/// <typeparam name="T"></typeparam>
public abstract class EmuCoreBinder<T> : InternalEmuCoreBinder,
IDeviceBinder<T, Keyboard_D>,
IDeviceBinder<T, GamePad_D>,
IDeviceBinder<T, DualShockController_D>,
IDeviceBinder<T, XboxController_D>,
IDeviceBinder<T, PSVController_D>,
IDeviceBinder<T, ScreenGamepad_D>
where T : Enum
{
//每一个实例代表一个对应模拟器平台的控制器索引
List<ControllerBinder> m_bindingPages = new List<ControllerBinder>();
public EmuCoreBinder()
{
var types = GetType().GetInterfaces();
for (int i = 0; i < ControllerCount; i++)
{
m_bindingPages.Add(new ControllerBinder(i, this));
}
foreach (var device in App.input.GetDevices())
{
foreach (var binding in m_bindingPages)
{
binding.RegistInputDevice(device);
}
}
App.input.OnDeviceLost += InputDevicesMgr_OnDeviceLost;
App.input.OnDeviceConnected += InputDevicesMgr_OnDeviceConnected;
}
private void InputDevicesMgr_OnDeviceConnected(InputDevice_D connectDevice)
{
foreach (var binding in m_bindingPages)
{
binding.RegistInputDevice(connectDevice);
}
}
private void InputDevicesMgr_OnDeviceLost(InputDevice_D lostDevice)
{
foreach (var binding in m_bindingPages)
{
binding.UnregistInputDevice(lostDevice);
}
}
internal void RaiseDeviceRegist(InputDevice_D device, ControllerBinder binding)
{
if (device is Keyboard_D keyboard) Bind(keyboard, binding);
else if (device is GamePad_D gamePad) Bind(gamePad, binding);
else if (device is DualShockController_D dsC) Bind(dsC, binding);
else if (device is XboxController_D xbC) Bind(xbC, binding);
else if (device is PSVController_D psvC) Bind(psvC, binding);
else if (device is ScreenGamepad_D screenGamepad) Bind(screenGamepad, binding);
else throw new NotImplementedException($"{device.GetType()}");
}
public bool Start(T emuControl, int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
foreach (var key in binding.GetBinding(emuControl))
{
if (key.Start) return true;
}
return false;
}
public bool Release(T emuControl, int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
foreach (var key in binding.GetBinding(emuControl))
{
if (key.Release) return true;
}
return false;
}
/// <summary>
/// 获取指定控件是否处于按下状态
/// <para>如果绑定了多个物理按键,则只有这多个物理按键全部不处于按下状态时,才会返回false</para>
/// </summary>
/// <param name="emuControl"></param>
/// <param name="controllerIndex"></param>
/// <returns></returns>
public bool GetKey(T emuControl, int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
foreach (var key in binding.GetBinding(emuControl))
{
if (key.Performing) return true;
}
return false;
}
/// <summary>
/// 获取调用帧是否有任意按键触发了按下操作
/// </summary>
/// <param name="controllerIndex"></param>
/// <returns></returns>
public bool AnyKeyDown(int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
return binding.AnyKeyDown();
}
/// <summary>
/// 获取指定控件的向量值
/// <para>通常用于摇杆类型的控件</para>
/// <para>如果同时绑定了多个物理输入设备,只会返回其中一个物理设备的向量值</para>
/// </summary>
/// <param name="emuControl">模拟器平台的具体键枚举</param>
/// <param name="controllerIndex">模拟器平台的控制器序号</param>
/// <returns></returns>
public Vector2 GetVector2(T emuControl, int controllerIndex)
{
var binding = m_bindingPages[controllerIndex];
foreach (var control in binding.GetBinding(emuControl))
{
if (!control.Performing) continue;
return control.GetVector2();
}
return default(Vector2);
}
/// <summary>
/// 获取指定控件的浮点值,取值范围为[0f,1f]
/// <para>通常用于线性类按键,例如PS手柄的扳机键</para>
/// <para>普通的按键也能读取这个值,但返回值只会有0f和1f两种值</para>
/// <para>如果同时绑定了多个物理控件,则会从所有处于按下状态的物理控件中取平均值</para>
/// </summary>
/// <param name="emuControl">模拟器平台的具体键枚举</param>
/// <param name="controllerIndex">模拟器平台的控制器序号</param>
/// <returns></returns>
public float GetFloat(T emuControl, int controllerIndex)
{
var totalFloat = 0f;
var totalControl = 0;
var binding = m_bindingPages[controllerIndex];
foreach (var key in binding.GetBinding(emuControl))
{
if (!key.Performing) continue;
totalControl++;
totalFloat += key.GetFlaot();
}
if (totalControl == 0) return default(float);
else return totalFloat / totalControl;
}
public class MapSetting : Dictionary<T, List<InputControl_C>> { }
public class ControllerBinder
{
Dictionary<Type, InputDevice_D> m_registedDevices = new Dictionary<Type, InputDevice_D>();
Dictionary<InputDevice_D, MapSetting> m_mapSetting = new Dictionary<InputDevice_D, MapSetting>();
public int ControllerIndex { get; }
public EmuCoreBinder<T> Host { get; }
internal ControllerBinder(int controllerIndex, EmuCoreBinder<T> host)
{
ControllerIndex = controllerIndex;
Host = host;
}
internal bool IsRegisted<DEVICE>() where DEVICE : InputDevice_D
{
var type = typeof(T);
return IsRegisted(type);
}
internal bool IsRegisted(Type deviceType)
{
return m_registedDevices.ContainsKey(deviceType);
}
internal void RegistInputDevice(InputDevice_D device)
{
var type = device.GetType();
if (IsRegisted(type)) return;
m_registedDevices.Add(type, device);
m_mapSetting[device] = new MapSetting();
Host.RaiseDeviceRegist(device, this);
}
internal void UnregistInputDevice(InputDevice_D device)
{
var type = device.GetType();
if (!IsRegisted(type)) return;
m_registedDevices.Remove(type);
m_mapSetting.Remove(device);
}
public void SetBinding(T emuBtn, InputControl_C key, int settingSlot)
{
var device = key.Device;
m_registedDevices.TryGetValue(device.GetType(), out var inputDevice);
Debug.Assert(inputDevice == device);
var setting = m_mapSetting[inputDevice];
if (!setting.TryGetValue(emuBtn, out var settingList))
{
settingList = new List<InputControl_C>();
setting[emuBtn] = settingList;
}
int needFixCount = settingSlot - settingList.Count + 1;
if (needFixCount > 0) for (int i = 0; i < needFixCount; i++) settingList.Add(null);
settingList[settingSlot] = key;
}
public InputControl_C GetBinding(T emuBtn, InputDevice_D device, int settingSlot)
{
m_mapSetting.TryGetValue(device, out var mapSetting);
if (mapSetting == null) return null;
mapSetting.TryGetValue(emuBtn, out var settingList);
if (settingList == null || settingSlot >= settingList.Count) return null;
return settingList[settingSlot];
}
private List<InputControl_C> m_caches = new List<InputControl_C>();
public IEnumerable<InputControl_C> GetBinding(T emuBtn)
{
m_caches.Clear();
foreach (var mapSettings in m_mapSetting.Values)
{
mapSettings.TryGetValue(emuBtn, out var bindControls);
if (bindControls != null)
{
m_caches.AddRange(bindControls);
}
}
return m_caches;
}
public bool AnyKeyDown()
{
foreach (var mapSettings in m_mapSetting.Values)
{
foreach (var keys in mapSettings.Values)
{
foreach (var key in keys)
{
if (key.Start) return true;
}
}
}
return false;
}
}
public abstract void Bind(Keyboard_D device, ControllerBinder controller);
public abstract void Bind(GamePad_D device, ControllerBinder controller);
public abstract void Bind(DualShockController_D device, ControllerBinder controller);
public abstract void Bind(XboxController_D device, ControllerBinder controller);
public abstract void Bind(PSVController_D device, ControllerBinder controller);
public abstract void Bind(ScreenGamepad_D device, ControllerBinder controller);
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c593acacf7f38e244aa08283266f1a2e

View File

@ -0,0 +1,17 @@
using AxibugEmuOnline.Client.InputDevices;
using System;
namespace AxibugEmuOnline.Client.Settings
{
/// <summary>
/// 在所有<see cref="EmuCoreBinder{T}"/>的派生类中实现此接口以支持一种设备的绑定
/// <para>一种<see cref="EmuCoreBinder{T}"/>
/// 一个<see cref="EmuCoreBinder{T}.ControllerBinder"/>可以与多种设备建立绑定,但设备类型不可重复</para>
/// </summary>
public interface IDeviceBinder<ENUM, DEVICE>
where ENUM : Enum
where DEVICE : InputDevice_D
{
void Bind(DEVICE device, EmuCoreBinder<ENUM>.ControllerBinder controller);
}
}

View File

@ -0,0 +1,12 @@
using AxibugProtobuf;
/// <summary>
/// 此类为内部继承, 请勿继承此类
/// </summary>
public abstract class InternalEmuCoreBinder
{
/// <summary> 所属核心 </summary>
public abstract RomPlatformType Platform { get; }
/// <summary> 控制器数量 </summary>
public abstract int ControllerCount { get; }
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 70fbaad26932617478d787c65e124da5

View File

@ -4,7 +4,7 @@ using VirtualNes.Core;
namespace AxibugEmuOnline.Client.Settings
{
public class NesKeyBinding : EmuCoreControllerKeyBinding<EnumButtonType>
public class NesKeyBinding : EmuCoreBinder<EnumButtonType>
{
public override RomPlatformType Platform => RomPlatformType.Nes;
public override int ControllerCount => 4;
@ -82,10 +82,10 @@ namespace AxibugEmuOnline.Client.Settings
controller.SetBinding(EnumButtonType.START, device.Start, 0);
controller.SetBinding(EnumButtonType.MIC, device.L, 0);
controller.SetBinding(EnumButtonType.LEFT, device.LeftStick.Left, 0);
controller.SetBinding(EnumButtonType.RIGHT, device.LeftStick.Right, 0);
controller.SetBinding(EnumButtonType.UP, device.LeftStick.Up, 0);
controller.SetBinding(EnumButtonType.DOWN, device.LeftStick.Down, 0);
controller.SetBinding(EnumButtonType.LEFT, device.LeftStick.Left, 1);
controller.SetBinding(EnumButtonType.RIGHT, device.LeftStick.Right, 1);
controller.SetBinding(EnumButtonType.UP, device.LeftStick.Up, 1);
controller.SetBinding(EnumButtonType.DOWN, device.LeftStick.Down, 1);
}
public override void Bind(XboxController_D device, ControllerBinder controller)
{
@ -99,10 +99,27 @@ namespace AxibugEmuOnline.Client.Settings
controller.SetBinding(EnumButtonType.START, device.Menu, 0);
controller.SetBinding(EnumButtonType.MIC, device.LeftBumper, 0);
controller.SetBinding(EnumButtonType.LEFT, device.LeftStick.Left, 0);
controller.SetBinding(EnumButtonType.RIGHT, device.LeftStick.Right, 0);
controller.SetBinding(EnumButtonType.UP, device.LeftStick.Up, 0);
controller.SetBinding(EnumButtonType.DOWN, device.LeftStick.Down, 0);
controller.SetBinding(EnumButtonType.LEFT, device.LeftStick.Left, 1);
controller.SetBinding(EnumButtonType.RIGHT, device.LeftStick.Right, 1);
controller.SetBinding(EnumButtonType.UP, device.LeftStick.Up, 1);
controller.SetBinding(EnumButtonType.DOWN, device.LeftStick.Down, 1);
}
public override void Bind(ScreenGamepad_D device, ControllerBinder controller)
{
controller.SetBinding(EnumButtonType.LEFT, device.LEFT, 0);
controller.SetBinding(EnumButtonType.RIGHT, device.RIGHT, 0);
controller.SetBinding(EnumButtonType.UP, device.UP, 0);
controller.SetBinding(EnumButtonType.DOWN, device.DOWN, 0);
controller.SetBinding(EnumButtonType.A, device.BTN_B, 0);
controller.SetBinding(EnumButtonType.B, device.BTN_A, 0);
controller.SetBinding(EnumButtonType.SELECT, device.OPTION_1, 0);
controller.SetBinding(EnumButtonType.START, device.OPTION_2, 0);
controller.SetBinding(EnumButtonType.MIC, device.OPTION_3, 0);
controller.SetBinding(EnumButtonType.LEFT, device.JOYSTICK.Left, 1);
controller.SetBinding(EnumButtonType.RIGHT, device.JOYSTICK.Right, 1);
controller.SetBinding(EnumButtonType.UP, device.JOYSTICK.Up, 1);
controller.SetBinding(EnumButtonType.DOWN, device.JOYSTICK.Down, 1);
}
}
}

View File

@ -1,10 +1,9 @@
using AxibugEmuOnline.Client.InputDevices;
using AxibugEmuOnline.Client.Settings;
using AxibugProtobuf;
namespace AxibugEmuOnline.Client
{
public class XMBKeyBinding : EmuCoreControllerKeyBinding<EnumCommand>
public class XMBKeyBinding : EmuCoreBinder<EnumCommand>
{
public override RomPlatformType Platform => RomPlatformType.Invalid;
public override int ControllerCount => 2;
@ -98,5 +97,20 @@ namespace AxibugEmuOnline.Client
controller.SetBinding(EnumCommand.SelectItemRight, device.LeftStick.Right, 1);
controller.SetBinding(EnumCommand.SelectItemUp, device.LeftStick.Up, 1);
}
public override void Bind(ScreenGamepad_D device, ControllerBinder controller)
{
controller.SetBinding(EnumCommand.Back, device.BTN_A, 0);
controller.SetBinding(EnumCommand.Enter, device.BTN_B, 0);
controller.SetBinding(EnumCommand.OptionMenu, device.OPTION_1, 0);
controller.SetBinding(EnumCommand.SelectItemDown, device.DOWN, 0);
controller.SetBinding(EnumCommand.SelectItemLeft, device.LEFT, 0);
controller.SetBinding(EnumCommand.SelectItemRight, device.RIGHT, 0);
controller.SetBinding(EnumCommand.SelectItemUp, device.UP, 0);
controller.SetBinding(EnumCommand.SelectItemDown, device.JOYSTICK.Down, 1);
controller.SetBinding(EnumCommand.SelectItemLeft, device.JOYSTICK.Left, 1);
controller.SetBinding(EnumCommand.SelectItemRight, device.JOYSTICK.Right, 1);
controller.SetBinding(EnumCommand.SelectItemUp, device.JOYSTICK.Up, 1);
}
}
}

View File

@ -68,7 +68,7 @@ namespace AxibugEmuOnline.Client.InputDevices
{
if (!typeof(InputControl_C).IsAssignableFrom(field.FieldType)) continue;
var controlIns = Activator.CreateInstance(field.FieldType, this, field.Name) as InputControl_C;
var controlIns = Activator.CreateInstance(field.FieldType, Device, field.Name) as InputControl_C;
controlIns.Parent = this;
field.SetValue(this, controlIns);

View File

@ -12,9 +12,7 @@ namespace AxibugEmuOnline.Client.InputDevices
public VirtualButton Left;
public VirtualButton Right;
public Stick_C(InputDevice_D device, string controlName) : base(device, controlName)
{
}
public Stick_C(InputDevice_D device, string controlName) : base(device, controlName) { }
protected override void OnUpdate()
{

View File

@ -0,0 +1,74 @@
using AxiInputSP;
using AxiInputSP.UGUI;
using System.Collections.Generic;
using UnityEngine;
namespace AxibugEmuOnline.Client.InputDevices
{
public class ScreenGamepad_D : InputDevice_D
{
public Button_C UP;
public Button_C DOWN;
public Button_C LEFT;
public Button_C RIGHT;
public Button_C BTN_A;
public Button_C BTN_B;
public Button_C BTN_C;
public Button_C BTN_D;
public Button_C BTN_E;
public Button_C BTN_F;
public Button_C OPTION_1;
public Button_C OPTION_2;
public Button_C OPTION_3;
public Button_C OPTION_4;
public Button_C HOME;
public Stick_C JOYSTICK;
AxiScreenGamepad m_linkUnityImpl;
Dictionary<Button_C, AxiInputUGuiBtnType> m_buttonTypes = new Dictionary<Button_C, AxiInputUGuiBtnType>();
public ScreenGamepad_D(AxiScreenGamepad linkMono, InputResolver resolver) : base(resolver)
{
m_linkUnityImpl = linkMono;
m_buttonTypes[UP] = AxiInputUGuiBtnType.UP;
m_buttonTypes[DOWN] = AxiInputUGuiBtnType.DOWN;
m_buttonTypes[LEFT] = AxiInputUGuiBtnType.LEFT;
m_buttonTypes[RIGHT] = AxiInputUGuiBtnType.RIGHT;
m_buttonTypes[BTN_A] = AxiInputUGuiBtnType.BTN_A;
m_buttonTypes[BTN_B] = AxiInputUGuiBtnType.BTN_B;
m_buttonTypes[BTN_C] = AxiInputUGuiBtnType.BTN_C;
m_buttonTypes[BTN_D] = AxiInputUGuiBtnType.BTN_D;
m_buttonTypes[BTN_E] = AxiInputUGuiBtnType.BTN_E;
m_buttonTypes[BTN_F] = AxiInputUGuiBtnType.BTN_F;
m_buttonTypes[OPTION_1] = AxiInputUGuiBtnType.OPTION_1;
m_buttonTypes[OPTION_2] = AxiInputUGuiBtnType.OPTION_2;
m_buttonTypes[OPTION_3] = AxiInputUGuiBtnType.OPTION_3;
m_buttonTypes[OPTION_4] = AxiInputUGuiBtnType.OPTION_4;
m_buttonTypes[HOME] = AxiInputUGuiBtnType.HOME;
}
public bool CheckPerforming<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C
{
if (control is Button_C)
{
var type = m_buttonTypes[control as Button_C];
return m_linkUnityImpl.GetKey(type);
}
else if (control is Stick_C)
{
var vec2 = GetVector2(control);
return vec2.x != 0 || vec2.y != 0;
}
else return false;
}
public Vector2 GetVector2<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C
{
if (control is Stick_C)
{
return m_linkUnityImpl.GetJoystickValue();
}
else return default;
}
}
}

View File

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: dbfeb8011d9b4a8429a35bc162c72c57

View File

@ -13,14 +13,21 @@ namespace AxibugEmuOnline.Client.InputDevices
public delegate void OnDeviceLostHandle(InputDevice_D lostDevice);
public event OnDeviceLostHandle OnDeviceLost;
bool m_quiting;
public InputDevicesManager()
{
Application.quitting += Application_quitting;
m_inputResolver.OnDeviceConnected += Resolver_OnDeviceConnected;
m_inputResolver.OnDeviceLost += Resolver_OnDeviceLost;
foreach (var device in m_inputResolver.GetDevices())
AddDevice(device);
}
private void Application_quitting()
{
m_quiting = true;
}
private void Resolver_OnDeviceLost(InputDevice_D lostDevice)
{
RemoveDevice(lostDevice);
@ -39,6 +46,8 @@ namespace AxibugEmuOnline.Client.InputDevices
void RemoveDevice(InputDevice_D device)
{
if (m_quiting) return;
m_devices.Remove(device.UniqueName);
OnDeviceLost?.Invoke(device);
}

View File

@ -1,6 +1,6 @@
using System.Collections.Generic;
using AxiInputSP.UGUI;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
namespace AxibugEmuOnline.Client.InputDevices
{
@ -18,25 +18,64 @@ namespace AxibugEmuOnline.Client.InputDevices
throw new System.NotImplementedException();
#endif
}
DualWayDictionary<AxiScreenGamepad, ScreenGamepad_D> m_devices = new DualWayDictionary<AxiScreenGamepad, ScreenGamepad_D>();
/// <summary> 禁止外部构造 </summary>
protected InputResolver()
{
AxiScreenGamepad.OnGamepadActive += AxiScreenGamepad_OnGamepadActive;
AxiScreenGamepad.OnGamepadDisactive += AxiScreenGamepad_OnGamepadDisactive;
OnInit();
}
private void AxiScreenGamepad_OnGamepadDisactive(AxiScreenGamepad sender)
{
if (m_devices.TryGetValue(sender, out var device))
{
m_devices.Remove(sender);
RaiseDeviceLost(device);
}
}
private void AxiScreenGamepad_OnGamepadActive(AxiScreenGamepad sender)
{
var newDevice = new ScreenGamepad_D(sender, this);
m_devices[sender] = newDevice;
RaiseDeviceConnected(newDevice);
}
protected abstract void OnInit();
List<InputDevice_D> m_devicesResultCache = new List<InputDevice_D>();
/// <summary>
/// 获得所有当前已连入的输入设备
/// </summary>
/// <returns></returns>
public abstract IEnumerable<InputDevice_D> GetDevices();
public IEnumerable<InputDevice_D> GetDevices()
{
m_devicesResultCache.Clear();
m_devicesResultCache.AddRange(m_devices.Values);
m_devicesResultCache.AddRange(OnGetDevices());
return m_devicesResultCache;
}
/// <inheritdoc cref="GetDevices"/>
protected abstract IEnumerable<InputDevice_D> OnGetDevices();
/// <summary>
/// 检查指定输入设备是否还保持着连接
/// </summary>
/// <returns></returns>
public abstract bool CheckOnline(InputDevice_D device);
/// <summary> 检查指定输入设备是否还保持着连接 </summary>
public bool CheckOnline(InputDevice_D device)
{
if (device is ScreenGamepad_D)
{
return m_devices.TryGetKey(device as ScreenGamepad_D, out var _);
}
else
{
return OnCheckOnline(device);
}
}
/// <inheritdoc cref="CheckOnline(InputDevice_D)"/>
protected abstract bool OnCheckOnline(InputDevice_D device);
/// <param name="lostDevice">丢失的设备</param>
public delegate void OnDeviceLostHandle(InputDevice_D lostDevice);
@ -56,14 +95,51 @@ namespace AxibugEmuOnline.Client.InputDevices
OnDeviceConnected?.Invoke(connectDevice);
}
public abstract bool CheckPerforming<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C;
public abstract Vector2 GetVector2<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C;
public abstract float GetFloat<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C;
public bool CheckPerforming<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C
{
if (control.Device is ScreenGamepad_D)
{
ScreenGamepad_D device = control.Device as ScreenGamepad_D;
return device.CheckPerforming(control);
}
else return OnCheckPerforming(control);
}
protected abstract bool OnCheckPerforming<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C;
public Vector2 GetVector2<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C
{
if (control.Device is ScreenGamepad_D)
{
ScreenGamepad_D device = control.Device as ScreenGamepad_D;
return device.GetVector2(control);
}
return OnGetVector2(control);
}
protected abstract Vector2 OnGetVector2<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C;
public float GetFloat<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C
{
return OnGetFloat(control);
}
protected abstract float OnGetFloat<CONTROLLER>(CONTROLLER control) where CONTROLLER : InputControl_C;
/// <summary>
/// 获得输入设备的唯一名称
/// </summary>
/// <param name="inputDevice">这个设备必须是由resolver提供,并且保持着连接</param>
/// <returns></returns>
public abstract string GetDeviceName(InputDevice_D inputDevice);
public string GetDeviceName(InputDevice_D inputDevice)
{
if (inputDevice is ScreenGamepad_D)
{
m_devices.TryGetKey(inputDevice as ScreenGamepad_D, out var realDeviceScript);
return $"{realDeviceScript.GetType().Name}_{realDeviceScript.GetHashCode()}";
}
else return OnGetDeviceName(inputDevice);
}
/// <inheritdoc cref="GetDeviceName(InputDevice_D)"/>
protected abstract string OnGetDeviceName(InputDevice_D inputDevice);
}
}

View File

@ -51,7 +51,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
return ipDev as T;
}
public override string GetDeviceName(InputDevice_D inputDevice)
protected override string OnGetDeviceName(InputDevice_D inputDevice)
{
var ipdev = GetInputSystemDevice<InputDevice>(inputDevice);
Debug.Assert(ipdev != null, "不能对已离线的设备获取名称");
@ -59,7 +59,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
return $"{ipdev.description.deviceClass}_{ipdev.description.interfaceName}_{ipdev.deviceId}";
}
public override bool CheckOnline(InputDevice_D device)
protected override bool OnCheckOnline(InputDevice_D device)
{
return m_devices.TryGetKey(device, out var _);
}
@ -73,24 +73,24 @@ namespace AxibugEmuOnline.Client.InputDevices.ForInputSystem
}
}
public override IEnumerable<InputDevice_D> GetDevices()
protected override IEnumerable<InputDevice_D> OnGetDevices()
{
return m_devices.Values;
}
public override bool CheckPerforming<CONTROLLER>(CONTROLLER control)
protected override bool OnCheckPerforming<CONTROLLER>(CONTROLLER control)
{
var ipControl = GetInputSystemControl(control);
return ipControl.IsPressed();
}
public override Vector2 GetVector2<CONTROLLER>(CONTROLLER control)
protected override Vector2 OnGetVector2<CONTROLLER>(CONTROLLER control)
{
var ipControl = GetInputSystemControl(control);
return (ipControl as InputControl<Vector2>).value;
}
public override float GetFloat<CONTROLLER>(CONTROLLER control)
protected override float OnGetFloat<CONTROLLER>(CONTROLLER control)
{
var ipControl = GetInputSystemControl(control);
return (ipControl as InputControl<float>).value;

View File

@ -15,24 +15,24 @@ namespace AxibugEmuOnline.Client.InputDevices.ForPSV
m_devices.Add(m_psvController);
}
public override IEnumerable<InputDevice_D> GetDevices()
protected override IEnumerable<InputDevice_D> OnGetDevices()
{
return m_devices;
}
public override bool CheckOnline(InputDevice_D device)
protected override bool OnCheckOnline(InputDevice_D device)
{
return device == m_psvController;
}
public override string GetDeviceName(InputDevice_D inputDevice)
protected override string OnGetDeviceName(InputDevice_D inputDevice)
{
Debug.Assert(inputDevice == m_psvController, "只支持psv控制器");
return nameof(PSVController_D);
}
public override bool CheckPerforming<CONTROLLER>(CONTROLLER control)
protected override bool OnCheckPerforming<CONTROLLER>(CONTROLLER control)
{
if (control.Device is PSVController_D psvCon)
{
@ -58,7 +58,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForPSV
throw new System.NotImplementedException();
}
public override Vector2 GetVector2<CONTROLLER>(CONTROLLER control)
protected override Vector2 OnGetVector2<CONTROLLER>(CONTROLLER control)
{
if (control.Device is PSVController_D psvCon)
{
@ -75,7 +75,7 @@ namespace AxibugEmuOnline.Client.InputDevices.ForPSV
throw new System.NotImplementedException();
}
public override float GetFloat<CONTROLLER>(CONTROLLER control)
protected override float OnGetFloat<CONTROLLER>(CONTROLLER control)
{
throw new System.NotImplementedException();
}

View File

@ -1,5 +1,4 @@
using AxiInputSP.UGUI;
using UnityEngine;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
@ -13,7 +12,6 @@ public class FloatingJoystick : Joystick
readonly static Color ShowColor = new Color(1F, 1f, 1F, 0.7f);
readonly static Color HideColor = new Color(1F, 1f, 1F, 0.3f);
AxiIptJoystick mAxiIptJoystick;
//一次新的摇杆移动
public static bool bNewTouchWithSkill = false;
@ -34,24 +32,7 @@ public class FloatingJoystick : Joystick
mIsMounseDown = false;
}
void OnEnable()
{
if (mAxiIptJoystick == null)
{
mAxiIptJoystick = new AxiIptJoystick(GetJoyRaw);
}
}
private void OnDisable()
{
if (mAxiIptJoystick != null)
{
mAxiIptJoystick.Dispose();
mAxiIptJoystick = null;
}
}
private Vector2Int GetJoyRaw()
public Vector2Int GetJoyRaw()
{
return this.RawInputV2;
}

View File

@ -1,4 +1,5 @@
using AxibugEmuOnline.Client.ClientCore;
using AxiInputSP.UGUI;
using System;
using System.Collections.Generic;
using UnityEngine;
@ -12,7 +13,7 @@ namespace AxibugEmuOnline.Client
[SerializeField] InputUI m_InputUI;
[SerializeField] OptionUI m_OptionUI;
[SerializeField] Transform m_Joystick;
[SerializeField] AxiScreenGamepad m_screenGamepad;
[SerializeField] PopTipsUI m_popTipsUI;
private void Awake()
@ -21,7 +22,7 @@ namespace AxibugEmuOnline.Client
m_InputUI.gameObject.SetActive(false);
m_Joystick.gameObject.SetActive(App.bUseGUIButton);
m_screenGamepad.gameObject.SetActive(App.bUseGUIButton);
}
public static void Input(Action<string> callback, string placeHolder, string defaultText)