mirror of
https://github.com/ppy/osu.git
synced 2024-11-14 16:37:26 +08:00
Add headers and generally improve the UI of the popover
This commit is contained in:
parent
02fefff5e7
commit
84d8d33ad7
@ -10,8 +10,10 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Collections;
|
using osu.Game.Collections;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.UserInterfaceV2;
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
@ -24,33 +26,48 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
{
|
{
|
||||||
public partial class BeatmapOptionsPopover : OsuPopover
|
public partial class BeatmapOptionsPopover : OsuPopover
|
||||||
{
|
{
|
||||||
private FillFlowContainer<OptionButton> buttonFlow = null!;
|
private FillFlowContainer buttonFlow = null!;
|
||||||
private readonly FooterButtonOptionsV2 footerButton;
|
private readonly FooterButtonOptionsV2 footerButton;
|
||||||
|
|
||||||
|
private WorkingBeatmap beatmapWhenOpening = null!;
|
||||||
|
|
||||||
public BeatmapOptionsPopover(FooterButtonOptionsV2 footerButton)
|
public BeatmapOptionsPopover(FooterButtonOptionsV2 footerButton)
|
||||||
{
|
{
|
||||||
this.footerButton = footerButton;
|
this.footerButton = footerButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ManageCollectionsDialog? manageCollectionsDialog, SongSelect? songSelect, OsuColour colours)
|
private void load(ManageCollectionsDialog? manageCollectionsDialog, SongSelect? songSelect, OsuColour colours, IBindable<WorkingBeatmap> beatmap)
|
||||||
{
|
{
|
||||||
Content.Padding = new MarginPadding(5);
|
Content.Padding = new MarginPadding(5);
|
||||||
|
|
||||||
Child = buttonFlow = new FillFlowContainer<OptionButton>
|
Child = buttonFlow = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Spacing = new Vector2(3),
|
Spacing = new Vector2(3),
|
||||||
};
|
};
|
||||||
|
|
||||||
addButton(@"Manage collections", FontAwesome.Solid.Book, () => manageCollectionsDialog?.Show());
|
beatmapWhenOpening = beatmap.Value;
|
||||||
addButton(@"Delete all difficulties", FontAwesome.Solid.Trash, () => songSelect?.DeleteBeatmap(), colours.Red);
|
|
||||||
addButton(@"Remove from unplayed", FontAwesome.Regular.TimesCircle, null);
|
addHeader("For all difficulties", beatmapWhenOpening.BeatmapSetInfo.ToString());
|
||||||
addButton(@"Clear local scores", FontAwesome.Solid.Eraser, () => songSelect?.ClearScores());
|
|
||||||
|
addButton(@"Delete beatmap", FontAwesome.Solid.Trash, () => songSelect?.DeleteBeatmap(), colours.Red1);
|
||||||
|
|
||||||
|
addHeader("For selected difficulty", beatmapWhenOpening.BeatmapInfo.DifficultyName);
|
||||||
|
|
||||||
|
// TODO: make work, and make show "unplayed" or "played" based on status.
|
||||||
|
addButton(@"Mark as played", FontAwesome.Regular.TimesCircle, null);
|
||||||
|
|
||||||
|
addButton(@"Hide", FontAwesome.Solid.Magic, null);
|
||||||
|
addButton(@"Clear all local scores", FontAwesome.Solid.Eraser, () => songSelect?.ClearScores(), colours.Red1);
|
||||||
|
|
||||||
if (songSelect != null && songSelect.AllowEditing)
|
if (songSelect != null && songSelect.AllowEditing)
|
||||||
addButton(@"Edit beatmap", FontAwesome.Solid.PencilAlt, () => songSelect.Edit());
|
addButton(@"Edit beatmap", FontAwesome.Solid.PencilAlt, () => songSelect.Edit());
|
||||||
|
|
||||||
|
addHeader("General");
|
||||||
|
|
||||||
|
addButton(@"Manage collections", FontAwesome.Solid.Book, () => manageCollectionsDialog?.Show());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -60,6 +77,33 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(this));
|
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OverlayColourProvider overlayColourProvider { get; set; } = null!;
|
||||||
|
|
||||||
|
private void addHeader(string text, string? context = null)
|
||||||
|
{
|
||||||
|
var textFlow = new OsuTextFlowContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Padding = new MarginPadding(10),
|
||||||
|
};
|
||||||
|
|
||||||
|
textFlow.AddText(text, t => t.Font = OsuFont.Default.With(weight: FontWeight.SemiBold));
|
||||||
|
|
||||||
|
if (context != null)
|
||||||
|
{
|
||||||
|
textFlow.NewLine();
|
||||||
|
textFlow.AddText(context, t =>
|
||||||
|
{
|
||||||
|
t.Colour = overlayColourProvider.Content2;
|
||||||
|
t.Font = t.Font.With(size: 13);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
buttonFlow.Add(textFlow);
|
||||||
|
}
|
||||||
|
|
||||||
private void addButton(LocalisableString text, IconUsage icon, Action? action, Color4? colour = null)
|
private void addButton(LocalisableString text, IconUsage icon, Action? action, Color4? colour = null)
|
||||||
{
|
{
|
||||||
var button = new OptionButton
|
var button = new OptionButton
|
||||||
@ -124,7 +168,7 @@ namespace osu.Game.Screens.Select.FooterV2
|
|||||||
{
|
{
|
||||||
int requested = e.Key - Key.Number1;
|
int requested = e.Key - Key.Number1;
|
||||||
|
|
||||||
OptionButton? found = buttonFlow.Children.ElementAtOrDefault(requested);
|
OptionButton? found = buttonFlow.Children.OfType<OptionButton>().ElementAtOrDefault(requested);
|
||||||
|
|
||||||
if (found != null)
|
if (found != null)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user