1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-02 06:09:55 +08:00

Merge pull request #34721 from bdach/branch-2

Fix even more issues with replay fail indicator
This commit is contained in:
Dean Herbert
2025-08-18 23:34:11 +09:00
committed by GitHub
Unverified
2 changed files with 21 additions and 7 deletions
+8 -5
View File
@@ -36,6 +36,7 @@ namespace osu.Game.Screens.Play
private SkinnableSound failSample = null!;
private AudioFilter failLowPassFilter = null!;
private AudioFilter failHighPassFilter = null!;
private Container content = null!;
private double? failTime;
@@ -44,7 +45,6 @@ namespace osu.Game.Screens.Play
public ReplayFailIndicator(GameplayClockContainer gameplayClockContainer)
{
AlwaysPresent = true;
Clock = this.gameplayClockContainer = gameplayClockContainer;
}
@@ -54,7 +54,6 @@ namespace osu.Game.Screens.Play
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;
Alpha = 0;
track = beatmap.Value.Track;
@@ -65,13 +64,14 @@ namespace osu.Game.Screens.Play
failSample = new SkinnableSound(new SampleInfo(@"Gameplay/failsound")),
failLowPassFilter = new AudioFilter(audio.TrackMixer),
failHighPassFilter = new AudioFilter(audio.TrackMixer, BQFType.HighPass),
new Container
content = new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 20,
Alpha = 0,
Children = new Drawable[]
{
new Box
@@ -132,7 +132,7 @@ namespace osu.Game.Screens.Play
// intentionally shorter than the actual fail animation
const double audio_sweep_duration = 1000;
this.FadeInFromZero(200, Easing.OutQuint);
content.FadeInFromZero(200, Easing.OutQuint);
this.ScaleTo(1.1f, audio_sweep_duration, Easing.OutElasticHalf);
this.TransformBindableTo(trackFreq, 0, audio_sweep_duration);
this.TransformBindableTo(volumeAdjustment, 0.5);
@@ -155,8 +155,11 @@ namespace osu.Game.Screens.Play
failSample.Play();
}
if (Time.Current < failTime)
if (Time.Current < failTime && failSamplePlaybackInitiated)
{
failSamplePlaybackInitiated = false;
failSample.Stop();
}
}
protected override void Dispose(bool isDisposing)
+13 -2
View File
@@ -197,8 +197,7 @@ namespace osu.Game.Screens.Play
public override void OnSuspending(ScreenTransitionEvent e)
{
// safety against filters or samples from the indicator playing long after the screen is exited
failIndicator.RemoveAndDisposeImmediately();
stopAllAudioEffects();
base.OnSuspending(e);
}
@@ -208,5 +207,17 @@ namespace osu.Game.Screens.Play
failIndicator.RemoveAndDisposeImmediately();
return base.OnExiting(e);
}
private void stopAllAudioEffects()
{
// safety against filters or samples from the indicator playing long after the screen is exited
failIndicator.RemoveAndDisposeImmediately();
if (GameplayClockContainer is MasterGameplayClockContainer master)
{
playbackSettings.UserPlaybackRate.UnbindFrom(master.UserPlaybackRate);
master.UserPlaybackRate.SetDefault();
}
}
}
}