如何使用 Photon 将播放器添加到人数最多但未满的房间?
How can I add the player to the room that has the most person but not full using Photon?
如何使用 Photon 将玩家添加到人最多但未满的房间,我正在开发一个使用 photon 的多人游戏,我阅读了 Photon 的页面文档但似乎没有任何好详细的信息,我想要的是当玩家点击播放时,他会被带到一个人最多但未满的服务器,这样可以加快游戏速度,他们不必等待其他玩家,任何关于这个?
使用OnRoomListUpdate
功能跟踪房间列表
List<RoomInfo> RoomsInfo { get; set; }
void OnRoomListUpdate(List<RoomInfo> roomList)
{
RoomsInfo = roomList.ToList();
}
现在通过列表检查玩家人数是否已满:
// Select non full rooms
var validRooms = RoomsInfo.Where(x => x.PlayerCount != x.MaxPlayers);
// Select the one of the most players
var room = validRooms.OrderByDescending(x => x.PlayerCount).FirstOrDefault();
这就是您想要的房间。
如何使用 Photon 将玩家添加到人最多但未满的房间,我正在开发一个使用 photon 的多人游戏,我阅读了 Photon 的页面文档但似乎没有任何好详细的信息,我想要的是当玩家点击播放时,他会被带到一个人最多但未满的服务器,这样可以加快游戏速度,他们不必等待其他玩家,任何关于这个?
使用OnRoomListUpdate
功能跟踪房间列表
List<RoomInfo> RoomsInfo { get; set; }
void OnRoomListUpdate(List<RoomInfo> roomList)
{
RoomsInfo = roomList.ToList();
}
现在通过列表检查玩家人数是否已满:
// Select non full rooms
var validRooms = RoomsInfo.Where(x => x.PlayerCount != x.MaxPlayers);
// Select the one of the most players
var room = validRooms.OrderByDescending(x => x.PlayerCount).FirstOrDefault();
这就是您想要的房间。