Reduce background brightness at PlayerLoader

This commit is contained in:
Dean Herbert 2019-06-25 17:22:10 +09:00
parent 7281b64eb6
commit 7bc7df2249
1 changed files with 22 additions and 0 deletions

View File

@ -247,6 +247,7 @@ private void cancelLoad()
public override void OnSuspending(IScreen next)
{
BackgroundBrightnessReduction = false;
base.OnSuspending(next);
cancelLoad();
}
@ -258,6 +259,7 @@ public override bool OnExiting(IScreen next)
cancelLoad();
Background.EnableUserDim.Value = false;
BackgroundBrightnessReduction = false;
return base.OnExiting(next);
}
@ -273,6 +275,22 @@ protected override void Dispose(bool isDisposing)
}
}
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 @@ protected override void Update()
// 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;
}
}