Skip to content

Commit

Permalink
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion osu.Game/Screens/Play/GameplayMenuOverlay.cs
Original file line number Diff line number Diff line change
@@ -44,7 +44,15 @@ public abstract partial class GameplayMenuOverlay : OverlayContainer, IKeyBindin
/// <summary>
/// Action that is invoked when <see cref="GlobalAction.Back"/> is triggered.
/// </summary>
protected virtual Action BackAction => () => InternalButtons.LastOrDefault()?.TriggerClick();
protected virtual Action BackAction => () =>
{
// We prefer triggering the button click as it will animate...
// but sometimes buttons aren't present (see FailOverlay's constructor as an example).
if (Buttons.Any())
Buttons.Last().TriggerClick();
else
OnQuit?.Invoke();
};

/// <summary>
/// Action that is invoked when <see cref="GlobalAction.Select"/> is triggered.
8 changes: 7 additions & 1 deletion osu.Game/Screens/Play/PauseOverlay.cs
Original file line number Diff line number Diff line change
@@ -29,7 +29,13 @@ public partial class PauseOverlay : GameplayMenuOverlay

private SkinnableSound pauseLoop;

protected override Action BackAction => () => InternalButtons.First().TriggerClick();
protected override Action BackAction => () =>
{
if (Buttons.Any())
Buttons.First().TriggerClick();
else
OnResume?.Invoke();
};

[BackgroundDependencyLoader]
private void load(OsuColour colours)

0 comments on commit e1a376c

Please sign in to comment.