mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 05:03:02 +08: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);
|
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()
|
private void updateLastSavedHash()
|
||||||
{
|
{
|
||||||
lastSavedHash = changeHandler?.CurrentStateHash;
|
lastSavedHash = changeHandler?.CurrentStateHash;
|
||||||
@ -869,6 +883,10 @@ namespace osu.Game.Screens.Edit
|
|||||||
fileMenuItems.Add(createDifficultyCreationMenu());
|
fileMenuItems.Add(createDifficultyCreationMenu());
|
||||||
fileMenuItems.Add(createDifficultySwitchMenu());
|
fileMenuItems.Add(createDifficultySwitchMenu());
|
||||||
|
|
||||||
|
fileMenuItems.Add(new EditorMenuItemSpacer());
|
||||||
|
|
||||||
|
fileMenuItems.Add(new EditorMenuItem("Delete difficulty", MenuItemType.Standard, deleteDifficulty));
|
||||||
|
|
||||||
fileMenuItems.Add(new EditorMenuItemSpacer());
|
fileMenuItems.Add(new EditorMenuItemSpacer());
|
||||||
fileMenuItems.Add(new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit));
|
fileMenuItems.Add(new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit));
|
||||||
return fileMenuItems;
|
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