From 6b744a14b0b7be3c0a0a36764359707cc5f80dab Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 15 Jun 2022 13:04:08 +0900 Subject: [PATCH] Move 'back' sample playback from OnResuming to OnExiting --- osu.Game/Screens/Menu/MainMenu.cs | 2 ++ osu.Game/Screens/OsuScreen.cs | 8 ++++---- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 6fc8039413..bcd4baa818 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -66,6 +66,8 @@ namespace osu.Game.Screens.Menu protected override BackgroundScreen CreateBackground() => background; + protected override bool PlayExitSound => false; + private Bindable holdDelay; private Bindable loginDisplayed; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 77db1285bd..e742a2821f 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -77,7 +77,7 @@ namespace osu.Game.Screens private Sample sampleExit; - protected virtual bool PlayResumeSound => true; + protected virtual bool PlayExitSound => true; public virtual float BackgroundParallaxAmount => 1; @@ -173,9 +173,6 @@ namespace osu.Game.Screens public override void OnResuming(ScreenTransitionEvent e) { - if (PlayResumeSound) - sampleExit?.Play(); - applyArrivingDefaults(true); // it's feasible to resume to a screen if the target screen never loaded successfully. @@ -215,6 +212,9 @@ namespace osu.Game.Screens public override bool OnExiting(ScreenExitEvent e) { + if (PlayExitSound) + sampleExit?.Play(); + if (ValidForResume && logo != null) onExitingLogo(); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index d75466764d..b7b3c6fde1 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play // We show the previous screen status protected override UserActivity? InitialActivity => null; - protected override bool PlayResumeSound => false; + protected override bool PlayExitSound => false; protected BeatmapMetadataDisplay MetadataInfo { get; private set; } = null!;