mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
Rename RoomDependencies -> OnlinePlayDependencies
This commit is contained in:
parent
04279e7f5c
commit
a27a647ae7
@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{
|
||||
private static IEnumerable<int> users => Enumerable.Range(0, 16);
|
||||
|
||||
public new TestMultiplayerSpectatorClient SpectatorClient => (TestMultiplayerSpectatorClient)RoomDependencies?.SpectatorClient;
|
||||
public new TestMultiplayerSpectatorClient SpectatorClient => (TestMultiplayerSpectatorClient)OnlinePlayDependencies?.SpectatorClient;
|
||||
|
||||
private MultiplayerGameplayLeaderboard leaderboard;
|
||||
private OsuConfigManager config;
|
||||
@ -98,7 +98,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddStep("change to standardised", () => config.SetValue(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised));
|
||||
}
|
||||
|
||||
protected override RoomTestDependencies CreateRoomDependencies() => new TestDependencies();
|
||||
protected override OnlinePlayTestDependencies CreateOnlinePlayDependencies() => new TestDependencies();
|
||||
|
||||
protected class TestDependencies : MultiplayerRoomTestDependencies
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[HeadlessTest]
|
||||
public class TestSceneMultiplayerRoomManager : MultiplayerTestScene
|
||||
{
|
||||
protected override RoomTestDependencies CreateRoomDependencies() => new TestDependencies();
|
||||
protected override OnlinePlayTestDependencies CreateOnlinePlayDependencies() => new TestDependencies();
|
||||
|
||||
public TestSceneMultiplayerRoomManager()
|
||||
: base(false)
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
|
||||
private TestRoomSettings settings;
|
||||
|
||||
protected override RoomTestDependencies CreateRoomDependencies() => new TestDependencies();
|
||||
protected override OnlinePlayTestDependencies CreateOnlinePlayDependencies() => new TestDependencies();
|
||||
|
||||
[SetUp]
|
||||
public new void Setup() => Schedule(() =>
|
||||
@ -120,7 +120,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
public OsuSpriteText ErrorText => ((MatchSettings)Settings).ErrorText;
|
||||
}
|
||||
|
||||
private class TestDependencies : RoomTestDependencies
|
||||
private class TestDependencies : OnlinePlayTestDependencies
|
||||
{
|
||||
protected override IRoomManager CreateRoomManager() => new TestRoomManager();
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
/// <summary>
|
||||
/// Contains the basic dependencies of multiplayer test scenes.
|
||||
/// </summary>
|
||||
public class MultiplayerRoomTestDependencies : RoomTestDependencies, IMultiplayerTestDependencies
|
||||
public class MultiplayerRoomTestDependencies : OnlinePlayTestDependencies, IMultiplayerTestDependencies
|
||||
{
|
||||
public TestMultiplayerClient Client { get; }
|
||||
public TestUserLookupCache LookupCache { get; }
|
||||
|
@ -17,12 +17,12 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
public const int PLAYER_1_ID = 55;
|
||||
public const int PLAYER_2_ID = 56;
|
||||
|
||||
public TestMultiplayerClient Client => RoomDependencies.Client;
|
||||
public new TestMultiplayerRoomManager RoomManager => RoomDependencies.RoomManager;
|
||||
public TestUserLookupCache LookupCache => RoomDependencies?.LookupCache;
|
||||
public TestSpectatorClient SpectatorClient => RoomDependencies?.SpectatorClient;
|
||||
public TestMultiplayerClient Client => OnlinePlayDependencies.Client;
|
||||
public new TestMultiplayerRoomManager RoomManager => OnlinePlayDependencies.RoomManager;
|
||||
public TestUserLookupCache LookupCache => OnlinePlayDependencies?.LookupCache;
|
||||
public TestSpectatorClient SpectatorClient => OnlinePlayDependencies?.SpectatorClient;
|
||||
|
||||
protected new MultiplayerRoomTestDependencies RoomDependencies => (MultiplayerRoomTestDependencies)base.RoomDependencies;
|
||||
protected new MultiplayerRoomTestDependencies OnlinePlayDependencies => (MultiplayerRoomTestDependencies)base.OnlinePlayDependencies;
|
||||
|
||||
private readonly bool joinRoom;
|
||||
|
||||
@ -62,6 +62,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddUntilStep("wait for room join", () => Client.Room != null);
|
||||
}
|
||||
|
||||
protected override RoomTestDependencies CreateRoomDependencies() => new MultiplayerRoomTestDependencies();
|
||||
protected override OnlinePlayTestDependencies CreateOnlinePlayDependencies() => new MultiplayerRoomTestDependencies();
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ using osu.Game.Users;
|
||||
namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
{
|
||||
/// <summary>
|
||||
/// A very simple <see cref="RoomManager"/> for use in online-play test scenes.
|
||||
/// A very simple <see cref="RoomManager"/> for use in online play test scenes.
|
||||
/// </summary>
|
||||
public class BasicTestRoomManager : IRoomManager
|
||||
{
|
||||
|
@ -9,7 +9,7 @@ using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface that defines the dependencies required for online-play test scenes.
|
||||
/// Interface that defines the dependencies required for online play test scenes.
|
||||
/// </summary>
|
||||
public interface IOnlinePlayTestDependencies
|
||||
{
|
||||
|
@ -13,9 +13,9 @@ using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
{
|
||||
/// <summary>
|
||||
/// Contains the basic dependencies of online-play test scenes.
|
||||
/// Contains the basic dependencies of online play test scenes.
|
||||
/// </summary>
|
||||
public class RoomTestDependencies : IReadOnlyDependencyContainer, IOnlinePlayTestDependencies
|
||||
public class OnlinePlayTestDependencies : IReadOnlyDependencyContainer, IOnlinePlayTestDependencies
|
||||
{
|
||||
public Bindable<Room> SelectedRoom { get; }
|
||||
public IRoomManager RoomManager { get; }
|
||||
@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
private readonly List<Drawable> drawableComponents = new List<Drawable>();
|
||||
private readonly DependencyContainer dependencies;
|
||||
|
||||
public RoomTestDependencies()
|
||||
public OnlinePlayTestDependencies()
|
||||
{
|
||||
SelectedRoom = new Bindable<Room>();
|
||||
RoomManager = CreateRoomManager();
|
@ -14,18 +14,22 @@ using osu.Game.Screens.OnlinePlay.Lounge.Components;
|
||||
namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
{
|
||||
/// <summary>
|
||||
/// A base test scene for all online-play components and screens.
|
||||
/// A base test scene for all online play components and screens.
|
||||
/// </summary>
|
||||
public abstract class OnlinePlayTestScene : ScreenTestScene, IOnlinePlayTestDependencies
|
||||
{
|
||||
public Bindable<Room> SelectedRoom => RoomDependencies?.SelectedRoom;
|
||||
public IRoomManager RoomManager => RoomDependencies?.RoomManager;
|
||||
public Bindable<FilterCriteria> Filter => RoomDependencies?.Filter;
|
||||
public OngoingOperationTracker OngoingOperationTracker => RoomDependencies?.OngoingOperationTracker;
|
||||
public OnlinePlayBeatmapAvailabilityTracker AvailabilityTracker => RoomDependencies?.AvailabilityTracker;
|
||||
public Bindable<Room> SelectedRoom => OnlinePlayDependencies?.SelectedRoom;
|
||||
public IRoomManager RoomManager => OnlinePlayDependencies?.RoomManager;
|
||||
public Bindable<FilterCriteria> Filter => OnlinePlayDependencies?.Filter;
|
||||
public OngoingOperationTracker OngoingOperationTracker => OnlinePlayDependencies?.OngoingOperationTracker;
|
||||
public OnlinePlayBeatmapAvailabilityTracker AvailabilityTracker => OnlinePlayDependencies?.AvailabilityTracker;
|
||||
|
||||
protected RoomTestDependencies RoomDependencies => delegatedDependencies?.RoomDependencies;
|
||||
private DelegatedRoomDependencyContainer delegatedDependencies;
|
||||
/// <summary>
|
||||
/// All dependencies required for online play components and screens.
|
||||
/// </summary>
|
||||
protected OnlinePlayTestDependencies OnlinePlayDependencies => dependencies?.OnlinePlayDependencies;
|
||||
|
||||
private DelegatedDependencyContainer dependencies;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
private readonly Container content;
|
||||
@ -42,8 +46,8 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
delegatedDependencies = new DelegatedRoomDependencyContainer(base.CreateChildDependencies(parent));
|
||||
return delegatedDependencies;
|
||||
dependencies = new DelegatedDependencyContainer(base.CreateChildDependencies(parent));
|
||||
return dependencies;
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
@ -51,46 +55,46 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
{
|
||||
// Reset the room dependencies to a fresh state.
|
||||
drawableDependenciesContainer.Clear();
|
||||
delegatedDependencies.RoomDependencies = CreateRoomDependencies();
|
||||
drawableDependenciesContainer.AddRange(RoomDependencies.DrawableComponents);
|
||||
dependencies.OnlinePlayDependencies = CreateOnlinePlayDependencies();
|
||||
drawableDependenciesContainer.AddRange(OnlinePlayDependencies.DrawableComponents);
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
/// Creates the room dependencies. Called every <see cref="Setup"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Any custom dependencies required for online-play sub-classes should be added here.
|
||||
/// Any custom dependencies required for online play sub-classes should be added here.
|
||||
/// </remarks>
|
||||
protected virtual RoomTestDependencies CreateRoomDependencies() => new RoomTestDependencies();
|
||||
protected virtual OnlinePlayTestDependencies CreateOnlinePlayDependencies() => new OnlinePlayTestDependencies();
|
||||
|
||||
/// <summary>
|
||||
/// A <see cref="IReadOnlyDependencyContainer"/> providing a mutable lookup source for room dependencies.
|
||||
/// A <see cref="IReadOnlyDependencyContainer"/> providing a mutable lookup source for online play dependencies.
|
||||
/// </summary>
|
||||
private class DelegatedRoomDependencyContainer : IReadOnlyDependencyContainer
|
||||
private class DelegatedDependencyContainer : IReadOnlyDependencyContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// The room's dependencies.
|
||||
/// The online play dependencies.
|
||||
/// </summary>
|
||||
public RoomTestDependencies RoomDependencies { get; set; }
|
||||
public OnlinePlayTestDependencies OnlinePlayDependencies { get; set; }
|
||||
|
||||
private readonly IReadOnlyDependencyContainer parent;
|
||||
private readonly DependencyContainer injectableDependencies;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="DelegatedRoomDependencyContainer"/>.
|
||||
/// Creates a new <see cref="DelegatedDependencyContainer"/>.
|
||||
/// </summary>
|
||||
/// <param name="parent">The fallback <see cref="IReadOnlyDependencyContainer"/> to use when <see cref="RoomDependencies"/> cannot satisfy a dependency.</param>
|
||||
public DelegatedRoomDependencyContainer(IReadOnlyDependencyContainer parent)
|
||||
/// <param name="parent">The fallback <see cref="IReadOnlyDependencyContainer"/> to use when <see cref="OnlinePlayDependencies"/> cannot satisfy a dependency.</param>
|
||||
public DelegatedDependencyContainer(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
injectableDependencies = new DependencyContainer(this);
|
||||
}
|
||||
|
||||
public object Get(Type type)
|
||||
=> RoomDependencies?.Get(type) ?? parent.Get(type);
|
||||
=> OnlinePlayDependencies?.Get(type) ?? parent.Get(type);
|
||||
|
||||
public object Get(Type type, CacheInfo info)
|
||||
=> RoomDependencies?.Get(type, info) ?? parent.Get(type, info);
|
||||
=> OnlinePlayDependencies?.Get(type, info) ?? parent.Get(type, info);
|
||||
|
||||
public void Inject<T>(T instance)
|
||||
where T : class
|
||||
|
Loading…
Reference in New Issue
Block a user