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:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user