mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Only call OnBackButton() if the screen has finished loading
This commit is contained in:
@ -651,9 +651,10 @@ namespace osu.Game
|
|||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Action = () =>
|
Action = () =>
|
||||||
{
|
{
|
||||||
var currentScreen = ScreenStack.CurrentScreen as IOsuScreen;
|
if (!(ScreenStack.CurrentScreen is IOsuScreen currentScreen))
|
||||||
|
return;
|
||||||
|
|
||||||
if (currentScreen?.AllowBackButton == true && !currentScreen.OnBackButton())
|
if (!((Drawable)currentScreen).IsLoaded || currentScreen.AllowBackButton && !currentScreen.OnBackButton())
|
||||||
ScreenStack.Exit();
|
ScreenStack.Exit();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -67,8 +67,11 @@ namespace osu.Game.Screens
|
|||||||
/// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>.
|
/// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
|
/// If this <see cref="IOsuScreen"/> has not yet finished loading, the exit will occur immediately without this method being invoked.
|
||||||
|
/// <para>
|
||||||
/// Return <c>true</c> to block this <see cref="IOsuScreen"/> from being exited after closing an overlay.
|
/// Return <c>true</c> to block this <see cref="IOsuScreen"/> from being exited after closing an overlay.
|
||||||
/// Return <c>false</c> if this <see cref="IOsuScreen"/> should continue exiting.
|
/// Return <c>false</c> if this <see cref="IOsuScreen"/> should continue exiting.
|
||||||
|
/// </para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
bool OnBackButton();
|
bool OnBackButton();
|
||||||
}
|
}
|
||||||
|
@ -665,7 +665,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public override bool OnBackButton()
|
public override bool OnBackButton()
|
||||||
{
|
{
|
||||||
if (ModSelect?.State.Value == Visibility.Visible)
|
if (ModSelect.State.Value == Visibility.Visible)
|
||||||
{
|
{
|
||||||
ModSelect.Hide();
|
ModSelect.Hide();
|
||||||
return true;
|
return true;
|
||||||
|
Reference in New Issue
Block a user