Flash back button when keyboard back binding is pressed

This commit is contained in:
Bartłomiej Dach 2022-05-07 12:59:15 +02:00
parent d4c9de8596
commit a716f62a6a
No known key found for this signature in database
GPG Key ID: BCECCD4FA41F6497

View File

@ -77,8 +77,10 @@ namespace osu.Game.Overlays.Mods
private ModSettingsArea modSettingsArea = null!;
private ColumnScrollContainer columnScroll = null!;
private ColumnFlowContainer columnFlow = null!;
private ShearedToggleButton? customisationButton;
private FillFlowContainer<ShearedButton> footerButtonFlow = null!;
private ShearedButton backButton = null!;
private ShearedToggleButton? customisationButton;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
@ -173,7 +175,7 @@ namespace osu.Game.Overlays.Mods
Horizontal = 70
},
Spacing = new Vector2(10),
ChildrenEnumerable = CreateFooterButtons().Prepend(new ShearedButton(BUTTON_WIDTH)
ChildrenEnumerable = CreateFooterButtons().Prepend(backButton = new ShearedButton(BUTTON_WIDTH)
{
Text = CommonStrings.Back,
Action = Hide,
@ -364,9 +366,12 @@ namespace osu.Game.Overlays.Mods
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
if (e.Action == GlobalAction.Back && customisationVisible.Value)
if (e.Action == GlobalAction.Back)
{
customisationVisible.Value = false;
if (customisationVisible.Value)
customisationVisible.Value = false;
else
backButton.TriggerClick();
return true;
}