mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:07:52 +08:00
Cache IDialogOverlay
in a simpler way
This commit is contained in:
parent
2c5a329b04
commit
0130c356ed
@ -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]
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user