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