diff --git a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs index 16cb94c65e..3e3f9eb9f3 100644 --- a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs +++ b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Beatmaps; +using osu.Game.Screens; using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual @@ -15,13 +16,20 @@ namespace osu.Game.Tests.Visual private PlayerLoader loader; private ScreenStack stack; + [Cached] + private BackgroundScreenStack backgroundStack; + + public TestCasePlayerLoader() + { + InputManager.Add(backgroundStack = new BackgroundScreenStack {RelativeSizeAxes = Axes.Both}); + InputManager.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both }); + } + [BackgroundDependencyLoader] private void load(OsuGameBase game) { Beatmap.Value = new DummyWorkingBeatmap(game); - InputManager.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both }); - AddStep("load dummy beatmap", () => stack.Push(loader = new PlayerLoader(() => new Player { AllowPause = false, diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fe12fce09b..8caa09cc7b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -354,8 +354,8 @@ namespace osu.Game.Screens.Play Background.EnableUserDim.Value = true; - storyboardReplacesBackground.BindTo(Background?.StoryboardReplacesBackground); - storyboardReplacesBackground.BindTo(storyboardContainer.StoryboardReplacesBackground); + storyboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); + storyboardContainer.StoryboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; Task.Run(() => diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 6b066fbe91..e358188fe9 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -159,7 +159,7 @@ namespace osu.Game.Screens.Play { // restore our screen defaults InitializeBackgroundElements(); - if (this.IsCurrentScreen() && (Background?.IsLoaded ?? false)) + if (this.IsCurrentScreen()) Background.EnableUserDim.Value = false; return base.OnHover(e); } @@ -168,7 +168,8 @@ namespace osu.Game.Screens.Play { if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) { - // show user setting preview + // Update background elements is only being called here because blur logic still exists in Player. + // Will need to be removed when resolving https://github.com/ppy/osu/issues/4322 UpdateBackgroundElements(); if (this.IsCurrentScreen()) Background.EnableUserDim.Value = true; @@ -245,8 +246,7 @@ namespace osu.Game.Screens.Play this.FadeOut(150); cancelLoad(); - if (Background != null) - Background.EnableUserDim.Value = false; + Background.EnableUserDim.Value = false; return base.OnExiting(next); }