Add OnBackButton bool to OsuScreen

This commit is contained in:
Joehu 2020-07-13 23:59:20 -07:00
parent e0d9e70404
commit 1a2f5cb477
3 changed files with 7 additions and 1 deletions

View File

@ -573,7 +573,9 @@ namespace osu.Game
Origin = Anchor.BottomLeft,
Action = () =>
{
if ((ScreenStack.CurrentScreen as IOsuScreen)?.AllowBackButton == true)
var currentScreen = ScreenStack.CurrentScreen as IOsuScreen;
if (currentScreen?.AllowBackButton == true && !currentScreen.OnBackButton())
ScreenStack.Exit();
}
},

View File

@ -56,5 +56,7 @@ namespace osu.Game.Screens
/// Whether mod rate adjustments are allowed to be applied.
/// </summary>
bool AllowRateAdjustments { get; }
bool OnBackButton();
}
}

View File

@ -258,5 +258,7 @@ namespace osu.Game.Screens
/// Note that the instance created may not be the used instance if it matches the BackgroundMode equality clause.
/// </summary>
protected virtual BackgroundScreen CreateBackground() => null;
public virtual bool OnBackButton() => false;
}
}