Added ability to edit mod presets

This commit is contained in:
cdwcgt
2023-03-07 02:00:40 +09:00
parent 778cde8932
commit 4858d3fd42
3 changed files with 316 additions and 3 deletions

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Configuration;
@ -17,7 +18,7 @@ using osu.Game.Rulesets.Mods;
namespace osu.Game.Overlays.Mods
{
public partial class ModPresetPanel : ModSelectPanel, IHasCustomTooltip<ModPreset>, IHasContextMenu
public partial class ModPresetPanel : ModSelectPanel, IHasCustomTooltip<ModPreset>, IHasContextMenu, IHasPopover
{
public readonly Live<ModPreset> Preset;
@ -91,7 +92,8 @@ namespace osu.Game.Overlays.Mods
public MenuItem[] ContextMenuItems => new MenuItem[]
{
new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => dialogOverlay?.Push(new DeleteModPresetDialog(Preset)))
new OsuMenuItem(CommonStrings.ButtonsEdit, MenuItemType.Highlighted, this.ShowPopover),
new OsuMenuItem(CommonStrings.ButtonsDelete, MenuItemType.Destructive, () => dialogOverlay?.Push(new DeleteModPresetDialog(Preset))),
};
#endregion
@ -102,5 +104,7 @@ namespace osu.Game.Overlays.Mods
settingChangeTracker?.Dispose();
}
public Popover GetPopover() => new EditPresetPopover(this);
}
}