From a27a647ae72a7610caa442af2c293db494ccf9ae Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 25 Jun 2021 18:07:47 +0900 Subject: [PATCH] Rename RoomDependencies -> OnlinePlayDependencies --- ...TestSceneMultiplayerGameplayLeaderboard.cs | 4 +- .../TestSceneMultiplayerRoomManager.cs | 2 +- .../TestScenePlaylistsMatchSettingsOverlay.cs | 4 +- .../MultiplayerRoomTestDependencies.cs | 2 +- .../Multiplayer/MultiplayerTestScene.cs | 12 ++--- .../Visual/OnlinePlay/BasicTestRoomManager.cs | 2 +- .../OnlinePlay/IOnlinePlayTestDependencies.cs | 2 +- ...ncies.cs => OnlinePlayTestDependencies.cs} | 6 +-- .../Visual/OnlinePlay/OnlinePlayTestScene.cs | 50 ++++++++++--------- 9 files changed, 44 insertions(+), 40 deletions(-) rename osu.Game/Tests/Visual/OnlinePlay/{RoomTestDependencies.cs => OnlinePlayTestDependencies.cs} (92%) diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs index b7ccc17397..2938e813b2 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboard.cs @@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { private static IEnumerable 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 { diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerRoomManager.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerRoomManager.cs index 225a9ff703..c750bbed4b 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerRoomManager.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerRoomManager.cs @@ -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) diff --git a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs index b52b6a6a0e..fd59ebad30 100644 --- a/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/Playlists/TestScenePlaylistsMatchSettingsOverlay.cs @@ -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(); } diff --git a/osu.Game/Tests/Visual/Multiplayer/MultiplayerRoomTestDependencies.cs b/osu.Game/Tests/Visual/Multiplayer/MultiplayerRoomTestDependencies.cs index 4c5afb9b58..e7885890b4 100644 --- a/osu.Game/Tests/Visual/Multiplayer/MultiplayerRoomTestDependencies.cs +++ b/osu.Game/Tests/Visual/Multiplayer/MultiplayerRoomTestDependencies.cs @@ -13,7 +13,7 @@ namespace osu.Game.Tests.Visual.Multiplayer /// /// Contains the basic dependencies of multiplayer test scenes. /// - public class MultiplayerRoomTestDependencies : RoomTestDependencies, IMultiplayerTestDependencies + public class MultiplayerRoomTestDependencies : OnlinePlayTestDependencies, IMultiplayerTestDependencies { public TestMultiplayerClient Client { get; } public TestUserLookupCache LookupCache { get; } diff --git a/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs b/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs index 6a9ae4c772..90ffc83ccd 100644 --- a/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs +++ b/osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs @@ -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(); } } diff --git a/osu.Game/Tests/Visual/OnlinePlay/BasicTestRoomManager.cs b/osu.Game/Tests/Visual/OnlinePlay/BasicTestRoomManager.cs index 81b93fe5b5..813e617ac5 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/BasicTestRoomManager.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/BasicTestRoomManager.cs @@ -14,7 +14,7 @@ using osu.Game.Users; namespace osu.Game.Tests.Visual.OnlinePlay { /// - /// A very simple for use in online-play test scenes. + /// A very simple for use in online play test scenes. /// public class BasicTestRoomManager : IRoomManager { diff --git a/osu.Game/Tests/Visual/OnlinePlay/IOnlinePlayTestDependencies.cs b/osu.Game/Tests/Visual/OnlinePlay/IOnlinePlayTestDependencies.cs index bc5d524bc4..8c262e718a 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/IOnlinePlayTestDependencies.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/IOnlinePlayTestDependencies.cs @@ -9,7 +9,7 @@ using osu.Game.Screens.OnlinePlay.Lounge.Components; namespace osu.Game.Tests.Visual.OnlinePlay { /// - /// Interface that defines the dependencies required for online-play test scenes. + /// Interface that defines the dependencies required for online play test scenes. /// public interface IOnlinePlayTestDependencies { diff --git a/osu.Game/Tests/Visual/OnlinePlay/RoomTestDependencies.cs b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestDependencies.cs similarity index 92% rename from osu.Game/Tests/Visual/OnlinePlay/RoomTestDependencies.cs rename to osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestDependencies.cs index 7b198c128b..e45aadfd84 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/RoomTestDependencies.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestDependencies.cs @@ -13,9 +13,9 @@ using osu.Game.Screens.OnlinePlay.Lounge.Components; namespace osu.Game.Tests.Visual.OnlinePlay { /// - /// Contains the basic dependencies of online-play test scenes. + /// Contains the basic dependencies of online play test scenes. /// - public class RoomTestDependencies : IReadOnlyDependencyContainer, IOnlinePlayTestDependencies + public class OnlinePlayTestDependencies : IReadOnlyDependencyContainer, IOnlinePlayTestDependencies { public Bindable SelectedRoom { get; } public IRoomManager RoomManager { get; } @@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay private readonly List drawableComponents = new List(); private readonly DependencyContainer dependencies; - public RoomTestDependencies() + public OnlinePlayTestDependencies() { SelectedRoom = new Bindable(); RoomManager = CreateRoomManager(); diff --git a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs index 6c1339fd85..e1c21ce377 100644 --- a/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs +++ b/osu.Game/Tests/Visual/OnlinePlay/OnlinePlayTestScene.cs @@ -14,18 +14,22 @@ using osu.Game.Screens.OnlinePlay.Lounge.Components; namespace osu.Game.Tests.Visual.OnlinePlay { /// - /// A base test scene for all online-play components and screens. + /// A base test scene for all online play components and screens. /// public abstract class OnlinePlayTestScene : ScreenTestScene, IOnlinePlayTestDependencies { - public Bindable SelectedRoom => RoomDependencies?.SelectedRoom; - public IRoomManager RoomManager => RoomDependencies?.RoomManager; - public Bindable Filter => RoomDependencies?.Filter; - public OngoingOperationTracker OngoingOperationTracker => RoomDependencies?.OngoingOperationTracker; - public OnlinePlayBeatmapAvailabilityTracker AvailabilityTracker => RoomDependencies?.AvailabilityTracker; + public Bindable SelectedRoom => OnlinePlayDependencies?.SelectedRoom; + public IRoomManager RoomManager => OnlinePlayDependencies?.RoomManager; + public Bindable Filter => OnlinePlayDependencies?.Filter; + public OngoingOperationTracker OngoingOperationTracker => OnlinePlayDependencies?.OngoingOperationTracker; + public OnlinePlayBeatmapAvailabilityTracker AvailabilityTracker => OnlinePlayDependencies?.AvailabilityTracker; - protected RoomTestDependencies RoomDependencies => delegatedDependencies?.RoomDependencies; - private DelegatedRoomDependencyContainer delegatedDependencies; + /// + /// All dependencies required for online play components and screens. + /// + protected OnlinePlayTestDependencies OnlinePlayDependencies => dependencies?.OnlinePlayDependencies; + + private DelegatedDependencyContainer dependencies; protected override Container 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); }); /// /// Creates the room dependencies. Called every . /// /// - /// 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. /// - protected virtual RoomTestDependencies CreateRoomDependencies() => new RoomTestDependencies(); + protected virtual OnlinePlayTestDependencies CreateOnlinePlayDependencies() => new OnlinePlayTestDependencies(); /// - /// A providing a mutable lookup source for room dependencies. + /// A providing a mutable lookup source for online play dependencies. /// - private class DelegatedRoomDependencyContainer : IReadOnlyDependencyContainer + private class DelegatedDependencyContainer : IReadOnlyDependencyContainer { /// - /// The room's dependencies. + /// The online play dependencies. /// - public RoomTestDependencies RoomDependencies { get; set; } + public OnlinePlayTestDependencies OnlinePlayDependencies { get; set; } private readonly IReadOnlyDependencyContainer parent; private readonly DependencyContainer injectableDependencies; /// - /// Creates a new . + /// Creates a new . /// - /// The fallback to use when cannot satisfy a dependency. - public DelegatedRoomDependencyContainer(IReadOnlyDependencyContainer parent) + /// The fallback to use when cannot satisfy a dependency. + 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 instance) where T : class