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;