Added close button and indictors of hotkeys to buttons

This commit is contained in:
Welsar55 2019-06-03 11:09:21 -05:00
parent fa331fbee1
commit 194bb80354
2 changed files with 25 additions and 6 deletions

View File

@ -57,11 +57,7 @@ public IEnumerable<Mod> Mods
protected override bool OnKeyDown(KeyDownEvent e)
{
if(e.Key == Key.Number1)
{
DeselectAll();
}
else if (ToggleKeys != null)
if (ToggleKeys != null)
{
var index = Array.IndexOf(ToggleKeys, e.Key);
if (index > -1 && index < buttons.Length)

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using osuTK;
using osuTK.Input;
using osuTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
@ -23,6 +24,7 @@
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays.Mods.Sections;
using osu.Game.Screens;
using osu.Framework.Input.Events;
namespace osu.Game.Overlays.Mods
{
@ -33,6 +35,7 @@ public class ModSelectOverlay : WaveOverlayContainer
protected Color4 LowMultiplierColour, HighMultiplierColour;
protected readonly TriangleButton DeselectAllButton;
protected readonly TriangleButton CloseButton;
protected readonly OsuSpriteText MultiplierLabel, UnrankedLabel;
private readonly FillFlowContainer footerContainer;
@ -192,6 +195,16 @@ private void modButtonPressed(Mod selectedMod)
refreshSelectedMods();
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Key == Key.Number1)
DeselectAll();
else if (e.Key == Key.Number2)
PopOut();
return base.OnKeyDown(e);
}
private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
public ModSelectOverlay()
@ -357,13 +370,23 @@ public ModSelectOverlay()
DeselectAllButton = new TriangleButton
{
Width = 180,
Text = "Deselect All",
Text = "1. Deselect All",
Action = DeselectAll,
Margin = new MarginPadding
{
Right = 20
}
},
CloseButton = new TriangleButton
{
Width = 180,
Text = "2. Close",
Action = PopOut,
Margin = new MarginPadding
{
Right = 20
}
},
new OsuSpriteText
{
Text = @"Score Multiplier:",