mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Fix the editor saving new beatmaps even when the user chooses not to
This commit is contained in:
parent
ec30ca24c5
commit
02e4f3ddaf
@ -84,6 +84,8 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
private bool isNewBeatmap;
|
||||
|
||||
protected override UserActivity InitialActivity => new UserActivity.Editing(Beatmap.Value.BeatmapInfo);
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
@ -113,8 +115,6 @@ namespace osu.Game.Screens.Edit
|
||||
// todo: remove caching of this and consume via editorBeatmap?
|
||||
dependencies.Cache(beatDivisor);
|
||||
|
||||
bool isNewBeatmap = false;
|
||||
|
||||
if (Beatmap.Value is DummyWorkingBeatmap)
|
||||
{
|
||||
isNewBeatmap = true;
|
||||
@ -287,6 +287,9 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
protected void Save()
|
||||
{
|
||||
// no longer new after first user-triggered save.
|
||||
isNewBeatmap = false;
|
||||
|
||||
// apply any set-level metadata changes.
|
||||
beatmapManager.Update(playableBeatmap.BeatmapInfo.BeatmapSet);
|
||||
|
||||
@ -435,7 +438,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
if (!exitConfirmed && dialogOverlay != null && HasUnsavedChanges && !(dialogOverlay.CurrentDialog is PromptForSaveDialog))
|
||||
if (!exitConfirmed && dialogOverlay != null && (isNewBeatmap || HasUnsavedChanges) && !(dialogOverlay.CurrentDialog is PromptForSaveDialog))
|
||||
{
|
||||
dialogOverlay?.Push(new PromptForSaveDialog(confirmExit, confirmExitWithSave));
|
||||
return true;
|
||||
@ -456,6 +459,12 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private void confirmExit()
|
||||
{
|
||||
if (isNewBeatmap)
|
||||
{
|
||||
// confirming exit without save means we should delete the new beatmap completely.
|
||||
beatmapManager.Delete(playableBeatmap.BeatmapInfo.BeatmapSet);
|
||||
}
|
||||
|
||||
exitConfirmed = true;
|
||||
this.Exit();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user