1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 05:23:05 +08:00

Unbind events affecting the background after gameplay has ended.

This commit is contained in:
Damnae 2017-09-14 15:58:55 +02:00
parent cb8029af9e
commit 7c3ce7e830

View File

@ -288,8 +288,8 @@ namespace osu.Game.Screens.Play
(Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, Easing.OutQuint); (Background as BackgroundScreenBeatmap)?.BlurTo(Vector2.Zero, 1500, Easing.OutQuint);
dimLevel.ValueChanged += value => updateBackgroundElements(); dimLevel.ValueChanged += dimLevel_ValueChanged;
showStoryboard.ValueChanged += value => updateBackgroundElements(); showStoryboard.ValueChanged += showStoryboard_ValueChanged;
updateBackgroundElements(); updateBackgroundElements();
Content.Alpha = 0; Content.Alpha = 0;
@ -331,6 +331,12 @@ namespace osu.Game.Screens.Play
return true; return true;
} }
private void dimLevel_ValueChanged(double newValue)
=> updateBackgroundElements();
private void showStoryboard_ValueChanged(bool newValue)
=> updateBackgroundElements();
private void updateBackgroundElements() private void updateBackgroundElements()
{ {
var opacity = 1 - (float)dimLevel; var opacity = 1 - (float)dimLevel;
@ -342,6 +348,9 @@ namespace osu.Game.Screens.Play
private void fadeOut() private void fadeOut()
{ {
dimLevel.ValueChanged -= dimLevel_ValueChanged;
showStoryboard.ValueChanged -= showStoryboard_ValueChanged;
const float fade_out_duration = 250; const float fade_out_duration = 250;
RulesetContainer?.FadeOut(fade_out_duration); RulesetContainer?.FadeOut(fade_out_duration);