1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 15:33:21 +08:00

Fix using "Back" binding at spectator fail screen not working

This commit is contained in:
Dean Herbert 2023-12-28 20:13:19 +09:00
parent 0fc86a07cb
commit e1a376c0a7
No known key found for this signature in database
2 changed files with 16 additions and 2 deletions

View File

@ -44,7 +44,15 @@ namespace osu.Game.Screens.Play
/// <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.

View File

@ -29,7 +29,13 @@ namespace osu.Game.Screens.Play
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)