mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 19:27:26 +08:00
Ensure only one dialog is being displayed by the SongSelect footer at a time
Fixes #1208
This commit is contained in:
parent
278e51eebc
commit
120446e4a7
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
@ -58,6 +59,31 @@ namespace osu.Game.Screens.Select
|
||||
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);
|
||||
|
||||
public Footer()
|
||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Screens.Select
|
||||
[BackgroundDependencyLoader]
|
||||
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(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2);
|
||||
|
@ -164,7 +164,7 @@ namespace osu.Game.Screens.Select
|
||||
if (Footer != null)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user