From ba81222af64a3e3b35f9c37c922da9748236279c Mon Sep 17 00:00:00 2001 From: n4b3l Date: Fri, 16 Dec 2016 17:13:24 +0100 Subject: [PATCH 1/6] basic background dim --- osu.Game/Screens/Play/Player.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7e6f5d2b55..d9cee732aa 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -21,6 +21,8 @@ using OpenTK; using osu.Framework.GameModes; using osu.Game.Modes.UI; using osu.Game.Screens.Ranking; +using osu.Game.Configuration; +using osu.Framework.Configuration; namespace osu.Game.Screens.Play { @@ -42,6 +44,7 @@ namespace osu.Game.Screens.Play private ScoreProcessor scoreProcessor; private HitRenderer hitRenderer; + private Bindable dimLevel; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game) @@ -110,6 +113,7 @@ namespace osu.Game.Screens.Play }, scoreOverlay, }; + dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); } protected override void LoadComplete() @@ -145,10 +149,17 @@ namespace osu.Game.Screens.Play base.OnEntering(last); (Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000); + (Background as BackgroundModeBeatmap)?.FadeTo((100f- dimLevel)/100,1000); Content.Alpha = 0; } + protected override bool OnExiting(GameMode next) + { + (Background as BackgroundModeBeatmap)?.FadeTo(1f, 0); + return base.OnExiting(next); + } + class PlayerInputManager : UserInputManager { public PlayerInputManager(BasicGameHost host) From c73fbe6e427d887768f4abba554eafb9561c8692 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 15:06:56 +0100 Subject: [PATCH 2/6] Remove unnecessary casts --- osu.Game/Screens/Play/Player.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d9cee732aa..5f28b0e17b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -149,14 +149,14 @@ namespace osu.Game.Screens.Play base.OnEntering(last); (Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000); - (Background as BackgroundModeBeatmap)?.FadeTo((100f- dimLevel)/100,1000); + Background?.FadeTo((100f- dimLevel)/100,1000); Content.Alpha = 0; } protected override bool OnExiting(GameMode next) { - (Background as BackgroundModeBeatmap)?.FadeTo(1f, 0); + Background?.FadeTo(1f, 0); return base.OnExiting(next); } From 36049cc4934e1f952f191af0a91495179a2def62 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 20:29:20 +0100 Subject: [PATCH 3/6] smoother transition --- osu.Game/Screens/Play/Player.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5f28b0e17b..427777b739 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -149,14 +149,14 @@ namespace osu.Game.Screens.Play base.OnEntering(last); (Background as BackgroundModeBeatmap)?.BlurTo(Vector2.Zero, 1000); - Background?.FadeTo((100f- dimLevel)/100,1000); + Background?.FadeTo((100f- dimLevel)/100, 1000); Content.Alpha = 0; } protected override bool OnExiting(GameMode next) { - Background?.FadeTo(1f, 0); + Background?.FadeTo(1f, 200); return base.OnExiting(next); } From 224e6a877aa854bdd4cc56e9f80e59592fd83980 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 20:59:41 +0100 Subject: [PATCH 4/6] responsive to dim changes --- osu.Game/Screens/Play/Player.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 427777b739..9b7c1f73d1 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -23,6 +23,7 @@ using osu.Game.Modes.UI; using osu.Game.Screens.Ranking; using osu.Game.Configuration; using osu.Framework.Configuration; +using System; namespace osu.Game.Screens.Play { @@ -44,7 +45,7 @@ namespace osu.Game.Screens.Play private ScoreProcessor scoreProcessor; private HitRenderer hitRenderer; - private Bindable dimLevel; + private Bindable dimLevel = new Bindable(); [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game) @@ -113,11 +114,13 @@ namespace osu.Game.Screens.Play }, scoreOverlay, }; - dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); + dimLevel.Weld(game.Config.GetBindable(OsuConfig.DimLevel)); + dimLevel.ValueChanged += dimChanged; } protected override void LoadComplete() { + base.LoadComplete(); Delay(250, true); @@ -156,10 +159,16 @@ namespace osu.Game.Screens.Play protected override bool OnExiting(GameMode next) { + dimLevel.ValueChanged -= dimChanged; Background?.FadeTo(1f, 200); return base.OnExiting(next); } + private void dimChanged(object sender, EventArgs e) + { + Background?.FadeTo((100f - dimLevel) / 100, 800); + } + class PlayerInputManager : UserInputManager { public PlayerInputManager(BasicGameHost host) From 0fbd2d8bc845af0fffe868c97754aa22a9babd67 Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sat, 17 Dec 2016 21:03:14 +0100 Subject: [PATCH 5/6] removed random enter --- osu.Game/Screens/Play/Player.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 9b7c1f73d1..6c83c70f4b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -120,7 +120,6 @@ namespace osu.Game.Screens.Play protected override void LoadComplete() { - base.LoadComplete(); Delay(250, true); From df305989d03304598cdf3e47c32654c1c823027e Mon Sep 17 00:00:00 2001 From: n4b3l Date: Sun, 18 Dec 2016 10:48:59 +0100 Subject: [PATCH 6/6] use config bindable directly --- osu.Game/Screens/Play/Player.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 6c83c70f4b..7b6f260c56 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Play private ScoreProcessor scoreProcessor; private HitRenderer hitRenderer; - private Bindable dimLevel = new Bindable(); + private Bindable dimLevel; [BackgroundDependencyLoader] private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game) @@ -114,8 +114,7 @@ namespace osu.Game.Screens.Play }, scoreOverlay, }; - dimLevel.Weld(game.Config.GetBindable(OsuConfig.DimLevel)); - dimLevel.ValueChanged += dimChanged; + dimLevel = game.Config.GetBindable(OsuConfig.DimLevel); } protected override void LoadComplete() @@ -154,6 +153,7 @@ namespace osu.Game.Screens.Play Background?.FadeTo((100f- dimLevel)/100, 1000); Content.Alpha = 0; + dimLevel.ValueChanged += dimChanged; } protected override bool OnExiting(GameMode next)