// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using osu.Framework.Allocation; using osu.Game.Online.API; using osu.Game.Online.Rooms; using osu.Game.Screens.OnlinePlay.Components; using osu.Game.Screens.OnlinePlay.Multiplayer; using osu.Game.Tests.Visual.OnlinePlay; namespace osu.Game.Tests.Visual.Multiplayer { /// /// A for use in multiplayer test scenes, backed by a . /// Should generally not be used by itself outside of a . /// public class TestRequestHandlingMultiplayerRoomManager : MultiplayerRoomManager { public IReadOnlyList ServerSideRooms => handler.ServerSideRooms; private readonly TestRoomRequestsHandler handler = new TestRoomRequestsHandler(); [BackgroundDependencyLoader] private void load(IAPIProvider api, OsuGameBase game) { ((DummyAPIAccess)api).HandleRequest = request => handler.HandleRequest(request, api.LocalUser.Value, game); } /// /// Adds a room to a local "server-side" list that's returned when a is fired. /// /// The room. public void AddServerSideRoom(Room room) => handler.AddServerSideRoom(room); } }