mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 20:32:55 +08:00
Fix mod overlay not closing on toggle hotkey
This commit is contained in:
parent
8f65e0e60f
commit
34cf4c6a38
@ -20,6 +20,7 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.Select;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
@ -44,6 +45,15 @@ namespace osu.Game.Overlays.Mods
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hotkey that should be used to hide the mod select screen.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is handled locally here rather than via <see cref="FooterButtonMods"/>, because this overlay is being registered at the game level
|
||||
/// and therefore takes away keyboard focus from the screen stack.
|
||||
/// </remarks>
|
||||
internal GlobalAction? Hotkey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether configurable <see cref="Mod"/>s can be configured by the local user.
|
||||
/// </summary>
|
||||
@ -321,12 +331,23 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
{
|
||||
if (e.Repeat)
|
||||
return false;
|
||||
|
||||
if (e.Action == GlobalAction.Back && customisationVisible.Value)
|
||||
{
|
||||
customisationVisible.Value = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (e.Action == Hotkey)
|
||||
{
|
||||
if (customisationVisible.Value)
|
||||
customisationVisible.Value = false;
|
||||
Hide();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnPressed(e);
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Overlays;
|
||||
@ -162,6 +163,7 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
|
||||
protected override ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(OverlayColourScheme.Plum)
|
||||
{
|
||||
Hotkey = GlobalAction.ToggleModSelection,
|
||||
IsValidMod = IsValidMod
|
||||
};
|
||||
|
||||
|
@ -333,7 +333,10 @@ namespace osu.Game.Screens.Select
|
||||
(new FooterButtonOptions(), BeatmapOptions)
|
||||
};
|
||||
|
||||
protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen();
|
||||
protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen
|
||||
{
|
||||
Hotkey = GlobalAction.ToggleModSelection
|
||||
};
|
||||
|
||||
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user