mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Disallow exiting the editor without saving (unless explicitly confirming)
This commit is contained in:
@ -98,7 +98,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private bool canSave;
|
||||
|
||||
private bool exitConfirmed;
|
||||
protected bool ExitConfirmed { get; private set; }
|
||||
|
||||
private string lastSavedHash;
|
||||
|
||||
@ -587,7 +587,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
if (!exitConfirmed)
|
||||
if (!ExitConfirmed)
|
||||
{
|
||||
// dialog overlay may not be available in visual tests.
|
||||
if (dialogOverlay == null)
|
||||
@ -596,12 +596,9 @@ namespace osu.Game.Screens.Edit
|
||||
return true;
|
||||
}
|
||||
|
||||
// if the dialog is already displayed, confirm exit with no save.
|
||||
// if the dialog is already displayed, block exiting until the user explicitly makes a decision.
|
||||
if (dialogOverlay.CurrentDialog is PromptForSaveDialog saveDialog)
|
||||
{
|
||||
saveDialog.PerformAction<PopupDialogDangerousButton>();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isNewBeatmap || HasUnsavedChanges)
|
||||
{
|
||||
@ -646,7 +643,7 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
Save();
|
||||
|
||||
exitConfirmed = true;
|
||||
ExitConfirmed = true;
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
@ -669,7 +666,7 @@ namespace osu.Game.Screens.Edit
|
||||
Beatmap.SetDefault();
|
||||
}
|
||||
|
||||
exitConfirmed = true;
|
||||
ExitConfirmed = true;
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user