1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-13 19:54:15 +08:00

Fix menu star fountains getting stuck looping sounds when leaving menu

- Alternative to / closes https://github.com/ppy/osu/pull/32565
- Closes https://github.com/ppy/osu/issues/32516
This commit is contained in:
Bartłomiej Dach
2025-03-25 13:19:17 +01:00
Unverified
parent 31487545d0
commit d908464f99
+10 -1
View File
@@ -20,6 +20,7 @@ using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Framework.Screens;
using osu.Framework.Threading;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
@@ -45,7 +46,7 @@ using osu.Game.Localisation;
namespace osu.Game.Screens.Menu
{
public partial class MainMenu : OsuScreen, IHandlePresentBeatmap, IKeyBindingHandler<GlobalAction>
public partial class MainMenu : OsuScreen, IHandlePresentBeatmap, IKeyBindingHandler<GlobalAction>, ISamplePlaybackDisabler
{
public const float FADE_IN_DURATION = 300;
@@ -84,6 +85,10 @@ namespace osu.Game.Screens.Menu
[Resolved(canBeNull: true)]
private IDialogOverlay dialogOverlay { get; set; }
// used to stop kiai fountain samples when navigating to other screens
IBindable<bool> ISamplePlaybackDisabler.SamplePlaybackDisabled => samplePlaybackDisabled;
private readonly Bindable<bool> samplePlaybackDisabled = new Bindable<bool>();
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
protected override bool PlayExitSound => false;
@@ -369,6 +374,8 @@ namespace osu.Game.Screens.Menu
supporterDisplay
.FadeOut(500, Easing.OutQuint);
samplePlaybackDisabled.Value = true;
}
public override void OnResuming(ScreenTransitionEvent e)
@@ -389,6 +396,8 @@ namespace osu.Game.Screens.Menu
bottomElementsFlow
.ScaleTo(1, 1000, Easing.OutQuint)
.FadeIn(1000, Easing.OutQuint);
samplePlaybackDisabled.Value = false;
}
public override bool OnExiting(ScreenExitEvent e)