1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00

Hardcode hide key handling in ModSelectScreen

This commit is contained in:
Dean Herbert 2022-05-08 01:30:21 +09:00
parent 0c2b4a6c0b
commit 0d32bf91eb
3 changed files with 16 additions and 24 deletions

View File

@ -20,11 +20,10 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Input.Bindings;
using osu.Game.Localisation;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select;
using osuTK;
using osuTK.Input;
using osu.Game.Localisation;
namespace osu.Game.Overlays.Mods
{
@ -49,15 +48,6 @@ 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 the total score multiplier calculated from the current selected set of mods should be shown.
/// </summary>
@ -382,6 +372,8 @@ namespace osu.Game.Overlays.Mods
if (e.Repeat)
return false;
// This is handled locally here because this overlay is being registered at the game level
// and therefore takes away keyboard focus from the screen stack.
if (e.Action == GlobalAction.Back)
{
if (customisationVisible.Value)
@ -391,15 +383,20 @@ namespace osu.Game.Overlays.Mods
return true;
}
if (e.Action == Hotkey || e.Action == GlobalAction.Select)
switch (e.Action)
{
if (customisationVisible.Value)
customisationVisible.Value = false;
Hide();
return true;
}
case GlobalAction.ToggleModSelection:
case GlobalAction.Select:
{
if (customisationVisible.Value)
customisationVisible.Value = false;
Hide();
return true;
}
return base.OnPressed(e);
default:
return base.OnPressed(e);
}
}
internal class ColumnScrollContainer : OsuScrollContainer<ColumnFlowContainer>

View File

@ -12,7 +12,6 @@ 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;
@ -163,7 +162,6 @@ namespace osu.Game.Screens.OnlinePlay
protected override ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen(OverlayColourScheme.Plum)
{
Hotkey = GlobalAction.ToggleModSelection,
IsValidMod = IsValidMod
};

View File

@ -333,10 +333,7 @@ namespace osu.Game.Screens.Select
(new FooterButtonOptions(), BeatmapOptions)
};
protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen
{
Hotkey = GlobalAction.ToggleModSelection
};
protected virtual ModSelectScreen CreateModSelectOverlay() => new UserModSelectScreen();
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
{