diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs index 9f790a2..b689f73 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs @@ -400,10 +400,31 @@ namespace AxibugEmuOnline.Client.Manager // OverlayManager.PopTip($"[{PlayerName}]进入房间,手柄位:P{i}"); // } //} - } - + } + /// - /// 发送修改玩家槽位 + /// 发送修改玩家槽位,但是增量 + /// + /// 玩家占用房间GamePlaySlot和LocalJoyIdx字典 + public void SendChangePlaySlotIdxWithJoyIdx(uint localJoyIndex, uint slotIndex) + { + if (!App.roomMgr.InRoom) return; + + Dictionary temp = new Dictionary(); + for (int i = 0; i < App.roomMgr.mineRoomMiniInfo.GamePlaySlotList.Count; i++) + { + var item = App.roomMgr.mineRoomMiniInfo.GamePlaySlotList[i]; + + if (item.PlayerUID <= 0) continue; + if (item.PlayerUID != App.user.userdata.UID) return; + temp[(uint)i] = (uint)item.PlayerLocalJoyIdx; + } + temp[slotIndex] = localJoyIndex; + + SendChangePlaySlotIdxWithJoyIdx(temp); + } + /// + /// 发送修改玩家槽位,全量 /// /// 玩家占用房间GamePlaySlot和LocalJoyIdx字典 public void SendChangePlaySlotIdxWithJoyIdx(Dictionary dictSlotIdx2LocalJoyIdx) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs index 45adb8c..6886e47 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/NesEmulator/NesControllerMapper.cs @@ -20,16 +20,16 @@ namespace AxibugEmuOnline.Client m_states[0] = m_states[1] = m_states[2] = m_states[3] = 0; if (Controller0.ConnectSlot.HasValue) m_states[Controller0.ConnectSlot.Value] = Controller0.GetButtons(); - else if (Controller0.AnyButtonPressed()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 0); + else if (Controller0.AnyButtonDown()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 0); if (Controller1.ConnectSlot.HasValue) m_states[Controller1.ConnectSlot.Value] = Controller1.GetButtons(); - else if (Controller1.AnyButtonPressed()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 1); + else if (Controller1.AnyButtonDown()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 1); if (Controller2.ConnectSlot.HasValue) m_states[Controller2.ConnectSlot.Value] = Controller2.GetButtons(); - else if (Controller2.AnyButtonPressed()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 2); + else if (Controller2.AnyButtonDown()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 2); if (Controller3.ConnectSlot.HasValue) m_states[Controller3.ConnectSlot.Value] = Controller3.GetButtons(); - else if (Controller3.AnyButtonPressed()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 3); + else if (Controller3.AnyButtonDown()) Eventer.Instance.PostEvent(EEvent.OnLocalJoyDesireInvert, 3); var result = new ControllerState(m_states); return result; @@ -151,18 +151,18 @@ namespace AxibugEmuOnline.Client return res; } - public bool AnyButtonPressed() + public bool AnyButtonDown() { return - UP.IsPressing || - DOWN.IsPressing || - LEFT.IsPressing || - RIGHT.IsPressing || - A.IsPressing || - B.IsPressing || - SELECT.IsPressing || - START.IsPressing || - MIC.IsPressing; + UP.IsDown || + DOWN.IsDown || + LEFT.IsDown || + RIGHT.IsDown || + A.IsDown || + B.IsDown || + SELECT.IsDown || + START.IsDown || + MIC.IsDown; } public static KeyListener GetKey(int controllerInput, EnumButtonType nesConBtnType) @@ -195,8 +195,10 @@ namespace AxibugEmuOnline.Client /// 按键监听器 KeyListener m_keyListener; - /// 指示按钮是否被按下 + /// 指示按钮是否正在按下状态 public bool IsPressing => m_keyListener.IsPressing(); + /// 指示按钮是否被按下 + public bool IsDown => m_keyListener.IsDown(); public Button(Controller controller, EnumButtonType buttonType) { @@ -212,7 +214,7 @@ namespace AxibugEmuOnline.Client /// public EnumButtonType SampleKey() { - return m_keyListener.IsPressing() ? m_buttonType : 0; + return IsPressing ? m_buttonType : 0; } private void CreateListener() @@ -246,6 +248,10 @@ namespace AxibugEmuOnline.Client { return Input.GetKey(m_key); } + public bool IsDown() + { + return Input.GetKeyDown(m_key); + } public override string ToString() { diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita.meta b/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita.meta new file mode 100644 index 0000000..ee12a21 --- /dev/null +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/PSVita.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4a4a14412f1bcc844bbd2c9bccf50db2 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs index 0486db7..871541c 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/UI/XMBTopGroupUI/ControllerInfoPanel.cs @@ -27,7 +27,7 @@ public class ControllerInfoPanel : MonoBehaviour //找到第一个空闲手柄插槽 var freeSlotIndex = s_freeSlots[0]; - //App.roomMgr.SendRoomSingelPlayerInput + App.roomMgr.SendChangePlaySlotIdxWithJoyIdx((uint)joyIndex, (uint)freeSlotIndex); } else //不在房间中,直接设置 {