From a0c5da7a0714a7d865c3f936f2da38370a40dc4f Mon Sep 17 00:00:00 2001 From: "ALIENJACK\\alien" Date: Wed, 25 Dec 2024 18:18:42 +0800 Subject: [PATCH] =?UTF-8?q?AppRoom=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E5=8F=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Assets/Script/AppMain/Manager/AppRoom.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs index c8033d7..9706c80 100644 --- a/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs +++ b/AxibugEmuOnline.Client/Assets/Script/AppMain/Manager/AppRoom.cs @@ -14,7 +14,7 @@ namespace AxibugEmuOnline.Client.Manager public class AppRoom { public Protobuf_Room_MiniInfo mineRoomMiniInfo { get; private set; } = null; - public bool InRoom => mineRoomMiniInfo != null; + public bool InRoom => App.user.IsLoggedIn && mineRoomMiniInfo != null; public bool IsHost => mineRoomMiniInfo?.HostPlayerUID == App.user.userdata.UID; public bool IsScreenProviderUID => mineRoomMiniInfo?.ScreenProviderUID == App.user.userdata.UID; public RoomGameState RoomState => mineRoomMiniInfo.GameState; @@ -512,16 +512,15 @@ namespace AxibugEmuOnline.Client.Manager /// /// /// - public static bool GetFreeSlot(this Protobuf_Room_MiniInfo roomMiniInfo, out int[] freeSlots) + public static bool GetFreeSlot(this Protobuf_Room_MiniInfo roomMiniInfo, ref List freeSlots) { - List temp = new List(); + freeSlots.Clear(); for (int i = 0; i < roomMiniInfo.GamePlaySlotList.Count; i++) { if (roomMiniInfo.GamePlaySlotList[i].PlayerUID <= 0) - temp.Add(i); + freeSlots.Add(i); } - freeSlots = temp.ToArray(); - return freeSlots.Length > 0; + return freeSlots.Count > 0; } /// @@ -530,15 +529,10 @@ namespace AxibugEmuOnline.Client.Manager public static bool GetPlayerSlotIdxByUid(this Protobuf_Room_MiniInfo roomMiniInfo, long uid, int joyIdx, out uint? slotIdx) { slotIdx = null; - //joyIdx取值返回[0,3],这个序号代表玩家本地的手柄编号 - //todo : 根据uid和controllerIndex 返回占用的位置 - - //目前未实现,所有非0号位置的手柄,都返回false - for (int i = 0; i < roomMiniInfo.GamePlaySlotList.Count; i++) { - if (roomMiniInfo.GamePlaySlotList[i].PlayerUID == uid) + if (roomMiniInfo.GamePlaySlotList[i].PlayerUID == uid && roomMiniInfo.GamePlaySlotList[i].PlayerLocalJoyIdx == joyIdx) { slotIdx = (uint)i; return true;