1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-30 05:59:53 +08:00

Avoid saving a state when clearly not dirty

This commit is contained in:
Dean Herbert
2025-04-07 19:37:16 +09:00
Unverified
parent f19fa73fb2
commit 3738d75202
2 changed files with 14 additions and 1 deletions
+4
View File
@@ -573,6 +573,9 @@ namespace osu.Game.Screens.Edit
return true;
}
[CanBeNull]
internal event Action Saved;
/// <summary>
/// Saves the currently edited beatmap.
/// </summary>
@@ -601,6 +604,7 @@ namespace osu.Game.Screens.Edit
isNewBeatmap = false;
updateLastSavedHash();
onScreenDisplay?.Display(new BeatmapEditorToast(ToastStrings.BeatmapSaved, editorBeatmap.BeatmapInfo.GetDisplayTitle()));
Saved?.Invoke();
return true;
}
+10 -1
View File
@@ -25,8 +25,13 @@ namespace osu.Game.Screens.Edit.Setup
private FormTextBox sourceTextBox = null!;
private FormTextBox tagsTextBox = null!;
private bool dirty = false;
public override LocalisableString Title => EditorSetupStrings.MetadataHeader;
[Resolved]
private Editor editor { get; set; }
[BackgroundDependencyLoader]
private void load(SetupScreen? setupScreen)
{
@@ -73,11 +78,13 @@ namespace osu.Game.Screens.Edit.Setup
item.Current.BindValueChanged(_ => applyMetadata());
item.OnCommit += (_, newText) =>
{
if (newText)
if (newText && dirty)
Beatmap.SaveState();
};
}
editor.Saved += () => dirty = false;
updateReadOnlyState();
}
@@ -124,6 +131,8 @@ namespace osu.Game.Screens.Edit.Setup
Beatmap.BeatmapInfo.DifficultyName = difficultyTextBox.Current.Value;
Beatmap.Metadata.Source = sourceTextBox.Current.Value;
Beatmap.Metadata.Tags = tagsTextBox.Current.Value;
dirty = true;
}
private partial class FormRomanisedTextBox : FormTextBox