From a860dd720893bf9f2eb950c64ef2d720477e7536 Mon Sep 17 00:00:00 2001 From: TocoToucan Date: Fri, 9 Feb 2018 00:06:24 +0300 Subject: [PATCH] =?UTF-8?q?Preview=20visual=20settings=20at=20the=20?= =?UTF-8?q?=E2=80=9Cloading=E2=80=9D=20screen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- osu.Game/Screens/Play/Player.cs | 5 +---- osu.Game/Screens/Play/PlayerBase.cs | 13 ++++++++++++- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 0f15592b72..8ebee96bae 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -262,10 +262,7 @@ protected override void OnEntering(Screen last) if (!loadedSuccessfully) return; - DimLevel.ValueChanged += _ => UpdateBackgroundElements(); - BlurLevel.ValueChanged += _ => UpdateBackgroundElements(); - ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); - UpdateBackgroundElements(); + ConfigureBackgroundUpdate(); Content.Alpha = 0; Content diff --git a/osu.Game/Screens/Play/PlayerBase.cs b/osu.Game/Screens/Play/PlayerBase.cs index c5a7e52de7..b725b739c9 100644 --- a/osu.Game/Screens/Play/PlayerBase.cs +++ b/osu.Game/Screens/Play/PlayerBase.cs @@ -46,6 +46,14 @@ private void load(AudioManager audio, OsuConfigManager config) UserAudioOffset = config.GetBindable(OsuSetting.AudioOffset); } + protected void ConfigureBackgroundUpdate() + { + DimLevel.ValueChanged += _ => UpdateBackgroundElements(); + BlurLevel.ValueChanged += _ => UpdateBackgroundElements(); + ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); + UpdateBackgroundElements(); + } + protected void UpdateBackgroundElements() { if (!IsCurrentScreen) return; @@ -60,7 +68,7 @@ protected void UpdateBackgroundElements() var beatmap = Beatmap.Value; var storyboardVisible = ShowStoryboard && beatmap.Storyboard.HasDrawable; - StoryboardContainer + StoryboardContainer? .FadeColour(OsuColour.Gray(opacity), duration, Easing.OutQuint) .FadeTo(storyboardVisible && opacity > 0 ? 1 : 0, duration, Easing.OutQuint); @@ -70,6 +78,9 @@ protected void UpdateBackgroundElements() protected void InitializeStoryboard(bool asyncLoad) { + if (StoryboardContainer == null) + return; + var beatmap = Beatmap.Value; Storyboard = beatmap.Storyboard.CreateDrawable(Beatmap.Value); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 0c6368c714..a4284efddb 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -88,7 +88,7 @@ protected override void OnEntering(Screen last) { base.OnEntering(last); - Background.FadeTo(0.4f, 250); + ConfigureBackgroundUpdate(); Content.ScaleTo(0.7f);