Ensure that all changes to screen backgrounds are on the correct thread

This commit is contained in:
Dean Herbert
2021-01-04 18:32:23 +09:00
parent a3e4e2f6c3
commit b3f08b29ca
12 changed files with 132 additions and 60 deletions

View File

@ -67,7 +67,7 @@ namespace osu.Game.Screens.Play
backgroundBrightnessReduction = value;
Background.FadeColour(OsuColour.Gray(backgroundBrightnessReduction ? 0.8f : 1), 200);
ApplyToBackground(b => b.FadeColour(OsuColour.Gray(backgroundBrightnessReduction ? 0.8f : 1), 200));
}
}
@ -176,12 +176,17 @@ namespace osu.Game.Screens.Play
{
base.OnEntering(last);
if (epilepsyWarning != null)
epilepsyWarning.DimmableBackground = Background;
ApplyToBackground(b =>
{
if (epilepsyWarning != null)
epilepsyWarning.DimmableBackground = b;
b?.FadeColour(Color4.White, 800, Easing.OutQuint);
});
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
content.ScaleTo(0.7f);
Background?.FadeColour(Color4.White, 800, Easing.OutQuint);
contentIn();
@ -225,7 +230,8 @@ namespace osu.Game.Screens.Play
content.ScaleTo(0.7f, 150, Easing.InQuint);
this.FadeOut(150);
Background.EnableUserDim.Value = false;
ApplyToBackground(b => b.EnableUserDim.Value = false);
BackgroundBrightnessReduction = false;
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
@ -270,16 +276,22 @@ namespace osu.Game.Screens.Play
if (inputManager.HoveredDrawables.Contains(VisualSettings))
{
// Preview user-defined background dim and blur when hovered on the visual settings panel.
Background.EnableUserDim.Value = true;
Background.BlurAmount.Value = 0;
ApplyToBackground(b =>
{
b.EnableUserDim.Value = true;
b.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;
ApplyToBackground(b =>
{
// Returns background dim and blur to the values specified by PlayerLoader.
b.EnableUserDim.Value = false;
b.BlurAmount.Value = BACKGROUND_BLUR;
});
BackgroundBrightnessReduction = true;
}