Tidy up dialog and deletion flow

This commit is contained in:
Dean Herbert
2022-09-02 17:07:09 +09:00
parent 605108c938
commit 9fd8067e11
3 changed files with 41 additions and 67 deletions

View File

@ -879,35 +879,6 @@ namespace osu.Game.Screens.Edit
clock.SeekForward(!trackPlaying, amount);
}
private void exportBeatmap()
{
Save();
new LegacyBeatmapExporter(storage).Export(Beatmap.Value.BeatmapSetInfo);
}
private void deleteDifficulty()
{
dialogOverlay?.Push(new PromptForDifficultyDeleteDialog(confirmDifficultyHide, confirmDifficultyDelete, () => { }));
}
private void confirmDifficultyHide()
{
var current = playableBeatmap.BeatmapInfo;
if (current is null) return;
beatmapManager.Hide(current);
switchBeatmapOrExit(current.BeatmapSet);
}
private void confirmDifficultyDelete()
{
var current = playableBeatmap.BeatmapInfo;
if (current is null) return;
beatmapManager.DeleteDifficultyImmediately(current);
switchBeatmapOrExit(current.BeatmapSet);
}
private void switchBeatmapOrExit([CanBeNull] BeatmapSetInfo setInfo)
{
if (setInfo is null || setInfo.Beatmaps.Count() <= 1)
@ -948,6 +919,29 @@ namespace osu.Game.Screens.Edit
return fileMenuItems;
}
private void exportBeatmap()
{
Save();
new LegacyBeatmapExporter(storage).Export(Beatmap.Value.BeatmapSetInfo);
}
private void deleteDifficulty()
{
if (dialogOverlay == null)
delete();
else
dialogOverlay.Push(new DeleteDifficultyConfirmationDialog(Beatmap.Value.BeatmapInfo, delete));
void delete()
{
var current = playableBeatmap.BeatmapInfo;
if (current is null) return;
beatmapManager.DeleteDifficultyImmediately(current);
switchBeatmapOrExit(current.BeatmapSet);
}
}
private EditorMenuItem createDifficultyCreationMenu()
{
var rulesetItems = new List<MenuItem>();