mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 22:22:54 +08:00
Fix failSample still playing after player left FailOverlay
This commit is contained in:
parent
292fd345bc
commit
a746cbc6ed
@ -51,6 +51,7 @@ namespace osu.Game.Screens.Play
|
||||
private const float duration = 2500;
|
||||
|
||||
private ISample? failSample;
|
||||
private SampleChannel? failSampleChannel;
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; } = null!;
|
||||
@ -125,7 +126,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
failHighPassFilter.CutoffTo(300);
|
||||
failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic);
|
||||
failSample?.Play();
|
||||
failSampleChannel = failSample?.Play();
|
||||
|
||||
track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);
|
||||
track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||
@ -153,6 +154,11 @@ namespace osu.Game.Screens.Play
|
||||
Background?.FadeColour(OsuColour.Gray(0.3f), 60);
|
||||
}
|
||||
|
||||
public void StopSample()
|
||||
{
|
||||
failSampleChannel?.Stop();
|
||||
}
|
||||
|
||||
public void RemoveFilters(bool resetTrackFrequency = true)
|
||||
{
|
||||
filtersRemoved = true;
|
||||
|
@ -612,6 +612,8 @@ namespace osu.Game.Screens.Play
|
||||
// if an exit has been requested, cancel any pending completion (the user has shown intention to exit).
|
||||
resultsDisplayDelegate?.Cancel();
|
||||
|
||||
failAnimationLayer.StopSample();
|
||||
|
||||
// The actual exit is performed if
|
||||
// - the pause / fail dialog was not requested
|
||||
// - the pause / fail dialog was requested but is already displayed (user showing intention to exit).
|
||||
@ -678,6 +680,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
sampleRestart?.Play();
|
||||
RestartRequested?.Invoke(quickRestart);
|
||||
failAnimationLayer.StopSample();
|
||||
|
||||
PerformExit(false);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user