1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Only play back sample once when traversing up multiple screens in stack

This commit is contained in:
Dean Herbert 2024-01-18 16:31:33 +09:00
parent ef0b5c9406
commit fd9c7184e4
No known key found for this signature in database

View File

@ -223,7 +223,12 @@ namespace osu.Game.Screens
public override bool OnExiting(ScreenExitEvent e)
{
if (ValidForResume && PlayExitSound)
// Only play the exit sound if we are the last screen in the exit sequence.
// This stops many sample playbacks from stacking when a huge screen purge happens (ie. returning to menu via the home button
// from a deeply nested screen).
bool arrivingAtFinalDestination = e.Next == e.Destination;
if (ValidForResume && PlayExitSound && arrivingAtFinalDestination)
sampleExit?.Play();
if (ValidForResume && logo != null)