1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 08:22:56 +08:00

Fix TestCasePlayerLoader not having a background stack

This commit is contained in:
David Zhao 2019-02-25 22:05:49 +09:00
parent 16fa30f71e
commit d750023c52
3 changed files with 16 additions and 8 deletions

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Screens;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
@ -15,13 +16,20 @@ namespace osu.Game.Tests.Visual
private PlayerLoader loader; private PlayerLoader loader;
private ScreenStack stack; 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] [BackgroundDependencyLoader]
private void load(OsuGameBase game) private void load(OsuGameBase game)
{ {
Beatmap.Value = new DummyWorkingBeatmap(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 AddStep("load dummy beatmap", () => stack.Push(loader = new PlayerLoader(() => new Player
{ {
AllowPause = false, AllowPause = false,

View File

@ -354,8 +354,8 @@ namespace osu.Game.Screens.Play
Background.EnableUserDim.Value = true; Background.EnableUserDim.Value = true;
storyboardReplacesBackground.BindTo(Background?.StoryboardReplacesBackground); storyboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground);
storyboardReplacesBackground.BindTo(storyboardContainer.StoryboardReplacesBackground); storyboardContainer.StoryboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground);
storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable;
Task.Run(() => Task.Run(() =>

View File

@ -159,7 +159,7 @@ namespace osu.Game.Screens.Play
{ {
// restore our screen defaults // restore our screen defaults
InitializeBackgroundElements(); InitializeBackgroundElements();
if (this.IsCurrentScreen() && (Background?.IsLoaded ?? false)) if (this.IsCurrentScreen())
Background.EnableUserDim.Value = false; Background.EnableUserDim.Value = false;
return base.OnHover(e); return base.OnHover(e);
} }
@ -168,7 +168,8 @@ namespace osu.Game.Screens.Play
{ {
if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) 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(); UpdateBackgroundElements();
if (this.IsCurrentScreen()) if (this.IsCurrentScreen())
Background.EnableUserDim.Value = true; Background.EnableUserDim.Value = true;
@ -245,8 +246,7 @@ namespace osu.Game.Screens.Play
this.FadeOut(150); this.FadeOut(150);
cancelLoad(); cancelLoad();
if (Background != null) Background.EnableUserDim.Value = false;
Background.EnableUserDim.Value = false;
return base.OnExiting(next); return base.OnExiting(next);
} }