1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

Fix BasicTestRoomManager overriding rooms

This commit is contained in:
smoogipoo 2021-08-17 09:36:59 +09:00
parent 352949069a
commit c4a42c4db0

View File

@ -28,6 +28,8 @@ namespace osu.Game.Tests.Visual.OnlinePlay
IBindableList<Room> IRoomManager.Rooms => Rooms;
private int currentRoomId;
public void CreateRoom(Room room, Action<Room> onSuccess = null, Action<string> onError = null)
{
room.RoomID.Value ??= Rooms.Select(r => r.RoomID.Value).Where(id => id != null).Select(id => id.Value).DefaultIfEmpty().Max() + 1;
@ -76,9 +78,9 @@ namespace osu.Game.Tests.Visual.OnlinePlay
{
var room = new Room
{
RoomID = { Value = i },
Position = { Value = i },
Name = { Value = $"Room {i}" },
RoomID = { Value = currentRoomId },
Position = { Value = currentRoomId },
Name = { Value = $"Room {currentRoomId}" },
Host = { Value = new User { Username = "Host" } },
EndDate = { Value = DateTimeOffset.Now + TimeSpan.FromSeconds(10) },
Category = { Value = i % 2 == 0 ? RoomCategory.Spotlight : RoomCategory.Normal },
@ -101,6 +103,8 @@ namespace osu.Game.Tests.Visual.OnlinePlay
}
CreateRoom(room);
currentRoomId++;
}
}
}