1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 01:07:25 +08:00

Merge pull request #5147 from peppy/reduce-background-brightness

Reduce background brightness at PlayerLoader
This commit is contained in:
Dan Balasescu 2019-06-25 19:58:25 +09:00 committed by GitHub
commit 89777c1743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -247,6 +247,7 @@ namespace osu.Game.Screens.Play
public override void OnSuspending(IScreen next)
{
BackgroundBrightnessReduction = false;
base.OnSuspending(next);
cancelLoad();
}
@ -258,6 +259,7 @@ namespace osu.Game.Screens.Play
cancelLoad();
Background.EnableUserDim.Value = false;
BackgroundBrightnessReduction = false;
return base.OnExiting(next);
}
@ -273,6 +275,22 @@ namespace osu.Game.Screens.Play
}
}
private bool backgroundBrightnessReduction;
protected bool BackgroundBrightnessReduction
{
get => backgroundBrightnessReduction;
set
{
if (value == backgroundBrightnessReduction)
return;
backgroundBrightnessReduction = value;
Background.FadeColour(OsuColour.Gray(backgroundBrightnessReduction ? 0.8f : 1), 200);
}
}
protected override void Update()
{
base.Update();
@ -287,12 +305,16 @@ namespace osu.Game.Screens.Play
// Preview user-defined background dim and blur when hovered on the visual settings panel.
Background.EnableUserDim.Value = true;
Background.BlurAmount.Value = 0;
BackgroundBrightnessReduction = false;
}
else
{
// Returns background dim and blur to the values specified by PlayerLoader.
Background.EnableUserDim.Value = false;
Background.BlurAmount.Value = BACKGROUND_BLUR;
BackgroundBrightnessReduction = true;
}
}