1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:53:51 +08:00

Use local private bindable in Player.cs

This commit is contained in:
David Zhao 2019-02-25 13:15:37 +09:00
parent af4606f3d2
commit ccc86b66fa

View File

@ -54,6 +54,7 @@ namespace osu.Game.Screens.Play
private Bindable<bool> mouseWheelDisabled; private Bindable<bool> mouseWheelDisabled;
private Bindable<double> userAudioOffset; private Bindable<double> userAudioOffset;
private Bindable<bool> storyboardReplacesBackground;
public int RestartCount; public int RestartCount;
@ -344,15 +345,17 @@ namespace osu.Game.Screens.Play
.Delay(250) .Delay(250)
.FadeIn(250); .FadeIn(250);
ShowStoryboard.ValueChanged += _ => ShowStoryboard.ValueChanged += s =>
{ {
if (ShowStoryboard.Value && storyboard == null) if (s.NewValue && storyboard == null)
initializeStoryboard(true); initializeStoryboard(true);
}; };
Background.EnableUserDim.Value = true; Background.EnableUserDim.Value = true;
storyboardContainer.StoryboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable;
storyboardContainer.StoryboardReplacesBackground.BindTo(Background?.StoryboardReplacesBackground); storyboardReplacesBackground.BindTo(Background?.StoryboardReplacesBackground);
storyboardReplacesBackground.BindTo(storyboardContainer.StoryboardReplacesBackground);
storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable;
Task.Run(() => Task.Run(() =>
{ {
@ -411,7 +414,7 @@ namespace osu.Game.Screens.Play
float fadeOutDuration = instant ? 0 : 250; float fadeOutDuration = instant ? 0 : 250;
this.FadeOut(fadeOutDuration); this.FadeOut(fadeOutDuration);
Background.EnableUserDim.Value = false; Background.EnableUserDim.Value = false;
storyboardContainer.StoryboardReplacesBackground.Value = false; storyboardReplacesBackground.Value = false;
} }
protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused.Value; protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused.Value;