mirror of
https://github.com/ppy/osu
synced 2025-02-15 09:37:07 +00:00
Merge pull request #1298 from peppy/song-select-toggle-overlays
Ensure only one dialog is being displayed by the SongSelect footer at a time
This commit is contained in:
commit
8853cab911
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
@ -58,6 +59,31 @@ namespace osu.Game.Screens.Select
|
|||||||
Action = action,
|
Action = action,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||||
|
|
||||||
|
/// <param name="text">Text on the button.</param>
|
||||||
|
/// <param name="colour">Colour of the button.</param>
|
||||||
|
/// <param name="hotkey">Hotkey of the button.</param>
|
||||||
|
/// <param name="overlay">The <see cref="OverlayContainer"/> to be toggled by this button.</param>
|
||||||
|
/// <param name="depth">
|
||||||
|
/// <para>Higher depth to be put on the left, and lower to be put on the right.</para>
|
||||||
|
/// <para>Notice this is different to <see cref="Options.BeatmapOptionsOverlay"/>!</para>
|
||||||
|
/// </param>
|
||||||
|
public void AddButton(string text, Color4 colour, OverlayContainer overlay, Key? hotkey = null, float depth = 0)
|
||||||
|
{
|
||||||
|
overlays.Add(overlay);
|
||||||
|
AddButton(text, colour, () =>
|
||||||
|
{
|
||||||
|
foreach (var o in overlays)
|
||||||
|
{
|
||||||
|
if (o == overlay)
|
||||||
|
overlay.ToggleVisibility();
|
||||||
|
else
|
||||||
|
overlay.Hide();
|
||||||
|
}
|
||||||
|
}, hotkey, depth);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, Easing.OutQuint);
|
private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
|
|
||||||
public Footer()
|
public Footer()
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Screens.Select
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue);
|
Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);
|
||||||
|
|
||||||
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
|
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
|
||||||
BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2);
|
BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2);
|
||||||
|
@ -164,7 +164,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (Footer != null)
|
if (Footer != null)
|
||||||
{
|
{
|
||||||
Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
|
Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
|
||||||
Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3);
|
Footer.AddButton(@"options", colours.Blue, BeatmapOptions, Key.F3);
|
||||||
|
|
||||||
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, () => promptDelete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
|
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, () => promptDelete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user