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

Merge pull request #26612 from peppy/fix-back-sample-playback

Fix back sound being too loud when exiting many screens
This commit is contained in:
Bartłomiej Dach 2024-01-22 16:18:32 +01:00 committed by GitHub
commit 4cd1573a4c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 8 additions and 5 deletions

View File

@ -40,8 +40,6 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
{
public override string Title => "Lounge";
protected override bool PlayExitSound => false;
protected override BackgroundScreen CreateBackground() => new LoungeBackgroundScreen
{
SelectedRoom = { BindTarget = SelectedRoom }

View File

@ -44,8 +44,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
public override string ShortTitle => "room";
protected override bool PlayExitSound => !exitConfirmed;
[Resolved]
private MultiplayerClient client { get; set; }

View File

@ -13,6 +13,8 @@ namespace osu.Game.Screens.OnlinePlay
public virtual string ShortTitle => Title;
protected sealed override bool PlayExitSound => false;
[Resolved]
protected IRoomManager? RoomManager { get; private set; }

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)