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

Small improvements to testable room manager

This commit is contained in:
smoogipoo 2020-12-19 01:57:40 +09:00
parent 9b0ca8fc3b
commit 7d1fe7955e

View File

@ -5,11 +5,13 @@ using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.Multiplayer;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.Multi.Lounge.Components;
using osu.Game.Screens.Multi.RealtimeMultiplayer;
namespace osu.Game.Tests.Visual.RealtimeMultiplayer
@ -22,6 +24,9 @@ namespace osu.Game.Tests.Visual.RealtimeMultiplayer
[Resolved]
private OsuGameBase game { get; set; }
[Cached]
public readonly Bindable<FilterCriteria> Filter = new Bindable<FilterCriteria>(new FilterCriteria());
private readonly List<Room> rooms = new List<Room>();
protected override void LoadComplete()
@ -29,6 +34,7 @@ namespace osu.Game.Tests.Visual.RealtimeMultiplayer
base.LoadComplete();
int currentScoreId = 0;
int currentRoomId = 0;
((DummyAPIAccess)api).HandleRequest = req =>
{
@ -38,7 +44,7 @@ namespace osu.Game.Tests.Visual.RealtimeMultiplayer
var createdRoom = new APICreatedRoom();
createdRoom.CopyFrom(createRoomRequest.Room);
createdRoom.RoomID.Value = 1;
createdRoom.RoomID.Value ??= currentRoomId++;
rooms.Add(createdRoom);
createRoomRequest.TriggerSuccess(createdRoom);
@ -103,6 +109,8 @@ namespace osu.Game.Tests.Visual.RealtimeMultiplayer
};
}
public new void ClearRooms() => base.ClearRooms();
public new void Schedule(Action action) => base.Schedule(action);
}
}