mirror of
https://github.com/ppy/osu
synced 2024-12-18 21:06:38 +00:00
Adds delete difficulty option to editor
This commit is contained in:
parent
c30e8047ab
commit
e6fad601cc
@ -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;
|
||||
|
33
osu.Game/Screens/Edit/PromptForDifficultyDeleteDialog.cs
Normal file
33
osu.Game/Screens/Edit/PromptForDifficultyDeleteDialog.cs
Normal 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
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user