1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 03:42:57 +08:00

Cache IDialogOverlay in a simpler way

This commit is contained in:
Dean Herbert 2023-07-25 18:31:28 +09:00
parent 2c5a329b04
commit 0130c356ed
2 changed files with 4 additions and 10 deletions

View File

@ -19,7 +19,8 @@ namespace osu.Game.Tournament.Tests
{
public abstract partial class TournamentTestScene : OsuManualInputManagerTestScene
{
protected DialogOverlay DialogOverlay = null!;
[Cached(typeof(IDialogOverlay))]
protected readonly DialogOverlay DialogOverlay = new DialogOverlay { Depth = float.MinValue };
[Cached]
protected LadderInfo Ladder { get; private set; } = new LadderInfo();
@ -47,9 +48,7 @@ namespace osu.Game.Tournament.Tests
Ruleset.BindTo(Ladder.Ruleset);
Dependencies.CacheAs(new StableInfo(storage));
Add(DialogOverlay = new DialogOverlay { Depth = -1 });
Dependencies.CacheAs<IDialogOverlay>(DialogOverlay);
Add(DialogOverlay);
}
[SetUpSteps]

View File

@ -42,11 +42,8 @@ namespace osu.Game.Tournament
private LoadingSpinner loadingSpinner;
[Cached(typeof(IDialogOverlay))]
private readonly DialogOverlay dialogOverlay = new DialogOverlay();
private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
[BackgroundDependencyLoader]
private void load(FrameworkConfigManager frameworkConfig, GameHost host)
@ -64,8 +61,6 @@ namespace osu.Game.Tournament
Margin = new MarginPadding(40),
});
dependencies.CacheAs<IDialogOverlay>(dialogOverlay);
// in order to have the OS mouse cursor visible, relative mode needs to be disabled.
// can potentially be removed when https://github.com/ppy/osu-framework/issues/4309 is resolved.
var mouseHandler = host.AvailableInputHandlers.OfType<MouseHandler>().FirstOrDefault();