1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Fix storyboard samples continuing to play when the beatmap is paused or the intro is skipped.

This commit is contained in:
Mysfit 2021-01-21 17:10:11 -05:00
parent 82848a7d70
commit b220939650
3 changed files with 26 additions and 5 deletions

View File

@ -353,7 +353,7 @@ namespace osu.Game.Screens.Play
},
skipOverlay = new SkipOverlay(DrawableRuleset.GameplayStartTime)
{
RequestSkip = GameplayClockContainer.Skip
RequestSkip = performUserRequestedSkip
},
FailOverlay = new FailOverlay
{
@ -488,6 +488,17 @@ namespace osu.Game.Screens.Play
this.Exit();
}
private void performUserRequestedSkip()
{
// user requested skip
// disable sample playback to stop currently playing samples and perform skip
samplePlaybackDisabled.Value = true;
GameplayClockContainer.Skip();
// return samplePlaybackDisabled.Value to what is defined by the beatmap's current state
updateSampleDisabledState();
}
private void performUserRequestedExit()
{
if (ValidForResume && HasFailed && !FailOverlay.IsPresent)

View File

@ -32,7 +32,7 @@ namespace osu.Game.Skinning
{
}
private readonly IBindable<bool> samplePlaybackDisabled = new Bindable<bool>();
protected readonly IBindable<bool> SamplePlaybackDisabled = new Bindable<bool>();
private ScheduledDelegate scheduledStart;
@ -42,8 +42,8 @@ namespace osu.Game.Skinning
// if in a gameplay context, pause sample playback when gameplay is paused.
if (samplePlaybackDisabler != null)
{
samplePlaybackDisabled.BindTo(samplePlaybackDisabler.SamplePlaybackDisabled);
samplePlaybackDisabled.BindValueChanged(disabled =>
SamplePlaybackDisabled.BindTo(samplePlaybackDisabler.SamplePlaybackDisabled);
SamplePlaybackDisabled.BindValueChanged(disabled =>
{
if (!RequestedPlaying) return;
@ -72,7 +72,7 @@ namespace osu.Game.Skinning
cancelPendingStart();
RequestedPlaying = true;
if (samplePlaybackDisabled.Value)
if (SamplePlaybackDisabled.Value)
return;
base.Play(restart);

View File

@ -40,6 +40,16 @@ namespace osu.Game.Storyboards.Drawables
foreach (var sample in DrawableSamples)
mod.ApplyToSample(sample);
}
SamplePlaybackDisabled.BindValueChanged(disabled =>
{
if (!RequestedPlaying) return;
// Since storyboard samples can be very long we want to stop the playback regardless of
// whether or not the sample is looping or not
if (disabled.NewValue)
Stop();
});
}
protected override void Update()