From 5169f7a43ca627acda15cf171ae41ea2430b761e Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sun, 24 Mar 2019 16:21:43 +0900 Subject: [PATCH] Change default for null screen parallax, apply reviews --- osu.Game/OsuGame.cs | 6 ++---- osu.Game/Screens/OsuScreenStack.cs | 5 +---- osu.Game/Tests/Visual/ScreenTestCase.cs | 5 +---- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 079a0d5bb6..7277990987 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -199,8 +199,6 @@ namespace osu.Game LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); - - screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; } private ExternalLinkOpener externalLinkOpener; @@ -388,7 +386,7 @@ namespace osu.Game RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - screenStack, + screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }, logoContainer = new Container { RelativeSizeAxes = Axes.Both }, } }, @@ -407,7 +405,7 @@ namespace osu.Game { logoContainer.Add(logo); - // Loader has to be created synchronously in order for DI to be successful for its background screen stack. + // Loader has to be created after the logo has finished loading as Loader performs logo transformations on entering. screenStack.Push(new Loader { RelativeSizeAxes = Axes.Both diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs index 1c929470d1..02e5919cdd 100644 --- a/osu.Game/Screens/OsuScreenStack.cs +++ b/osu.Game/Screens/OsuScreenStack.cs @@ -42,10 +42,7 @@ namespace osu.Game.Screens private void setParallax(IScreen prev, IScreen next) { - if (next != null) - { - parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next).BackgroundParallaxAmount; - } + parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next)?.BackgroundParallaxAmount ?? 1.0f; } } } diff --git a/osu.Game/Tests/Visual/ScreenTestCase.cs b/osu.Game/Tests/Visual/ScreenTestCase.cs index a8286f6d7b..eec60d01c5 100644 --- a/osu.Game/Tests/Visual/ScreenTestCase.cs +++ b/osu.Game/Tests/Visual/ScreenTestCase.cs @@ -15,10 +15,7 @@ namespace osu.Game.Tests.Visual protected ScreenTestCase() { - Children = new Drawable[] - { - stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both } - }; + Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; } protected void LoadScreen(OsuScreen screen)