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

Don't require exit confirmation when there are no ongoing operations that could be interrupted

This commit is contained in:
Dean Herbert 2023-06-21 18:27:29 +09:00
parent c3f772f0da
commit 59b1f08d53
3 changed files with 17 additions and 3 deletions

View File

@ -83,7 +83,7 @@ namespace osu.Game
/// </summary>
protected const float SIDE_OVERLAY_OFFSET_RATIO = 0.05f;
public Toolbar Toolbar;
public Toolbar Toolbar { get; private set; }
private ChatOverlay chatOverlay;
@ -778,8 +778,18 @@ namespace osu.Game
public override void AttemptExit()
{
// Using PerformFromScreen gives the user a chance to interrupt the exit process if needed.
PerformFromScreen(menu => menu.Exit());
bool requiresConfirmationToExit = Notifications.HasOngoingOperations;
PerformFromScreen(menu =>
{
var mainMenu = ((MainMenu)menu);
// The main menu exit implementation gives the user a chance to interrupt the exit process if needed.
if (requiresConfirmationToExit)
mainMenu.Exit();
else
mainMenu.ExitWithoutConfirmation();
}, new[] { typeof(MainMenu) });
}
/// <summary>

View File

@ -33,6 +33,8 @@ namespace osu.Game.Overlays
public const float TRANSITION_LENGTH = 600;
public bool HasOngoingOperations => sections.Any(s => s.Children.OfType<ProgressNotification>().Any());
private FlowContainer<NotificationSection> sections = null!;
[Resolved]

View File

@ -154,6 +154,8 @@ namespace osu.Game.Screens.Menu
public void ReturnToOsuLogo() => Buttons.State = ButtonSystemState.Initial;
public void ExitWithoutConfirmation() => confirmAndExit();
private void confirmAndExit()
{
if (exitConfirmed) return;