1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 12:47:25 +08:00

Adds delete difficulty option to editor

This commit is contained in:
Micahel Kelly 2022-07-27 19:15:43 +10:00
parent c30e8047ab
commit e6fad601cc
2 changed files with 51 additions and 0 deletions

View File

@ -849,6 +849,20 @@ namespace osu.Game.Screens.Edit
new LegacyBeatmapExporter(storage).Export(Beatmap.Value.BeatmapSetInfo);
}
private void deleteDifficulty()
{
dialogOverlay?.Push(new PromptForDifficultyDeleteDialog(confirmDifficultyDelete, () => { }));
}
private void confirmDifficultyDelete()
{
var current = playableBeatmap.BeatmapInfo;
if (current is null) return;
beatmapManager.Hide(current);
this.Exit();
}
private void updateLastSavedHash()
{
lastSavedHash = changeHandler?.CurrentStateHash;
@ -869,6 +883,10 @@ namespace osu.Game.Screens.Edit
fileMenuItems.Add(createDifficultyCreationMenu());
fileMenuItems.Add(createDifficultySwitchMenu());
fileMenuItems.Add(new EditorMenuItemSpacer());
fileMenuItems.Add(new EditorMenuItem("Delete difficulty", MenuItemType.Standard, deleteDifficulty));
fileMenuItems.Add(new EditorMenuItemSpacer());
fileMenuItems.Add(new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit));
return fileMenuItems;

View File

@ -0,0 +1,33 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics.Sprites;
using osu.Game.Overlays.Dialog;
namespace osu.Game.Screens.Edit
{
public class PromptForDifficultyDeleteDialog : PopupDialog
{
public PromptForDifficultyDeleteDialog(Action delete, Action cancel)
{
HeaderText = "Are you sure you want to delete this difficulty?";
Icon = FontAwesome.Regular.Save;
Buttons = new PopupDialogButton[]
{
new PopupDialogDangerousButton
{
Text = @"Yes delete this difficulty!",
Action = delete
},
new PopupDialogCancelButton
{
Text = @"Oops, continue editing",
Action = cancel
},
};
}
}
}