mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 19:22:56 +08:00
Handle control key with OnKeyUp/OnKeyDown.
This commit is contained in:
parent
cb4563d169
commit
47b4ef5cd2
@ -22,10 +22,10 @@ namespace osu.Game.Screens.Select
|
|||||||
public class PlaySongSelect : SongSelect
|
public class PlaySongSelect : SongSelect
|
||||||
{
|
{
|
||||||
private OsuScreen player;
|
private OsuScreen player;
|
||||||
private UserInputManager input;
|
|
||||||
private readonly ModSelectOverlay modSelect;
|
private readonly ModSelectOverlay modSelect;
|
||||||
private readonly BeatmapDetailArea beatmapDetails;
|
private readonly BeatmapDetailArea beatmapDetails;
|
||||||
private IEnumerable<Mod> originalMods;
|
private IEnumerable<Mod> originalMods;
|
||||||
|
private bool controlPressed;
|
||||||
|
|
||||||
public PlaySongSelect()
|
public PlaySongSelect()
|
||||||
{
|
{
|
||||||
@ -46,10 +46,8 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, UserInputManager input)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
this.input = input;
|
|
||||||
|
|
||||||
Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue);
|
Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue);
|
||||||
|
|
||||||
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
|
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
|
||||||
@ -111,12 +109,24 @@ namespace osu.Game.Screens.Select
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
controlPressed = state.Keyboard.ControlPressed;
|
||||||
|
return base.OnKeyDown(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyUp(InputState state, KeyUpEventArgs args)
|
||||||
|
{
|
||||||
|
controlPressed = state.Keyboard.ControlPressed;
|
||||||
|
return base.OnKeyUp(state, args);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnSelected()
|
protected override void OnSelected()
|
||||||
{
|
{
|
||||||
if (player != null) return;
|
if (player != null) return;
|
||||||
|
|
||||||
originalMods = modSelect.SelectedMods.Value;
|
originalMods = modSelect.SelectedMods.Value;
|
||||||
if (input.CurrentState.Keyboard.ControlPressed)
|
if (controlPressed)
|
||||||
if (findAutoMod(originalMods) == null)
|
if (findAutoMod(originalMods) == null)
|
||||||
{
|
{
|
||||||
var auto = findAutoMod(Ruleset.Value.CreateInstance().GetModsFor(ModType.Special));
|
var auto = findAutoMod(Ruleset.Value.CreateInstance().GetModsFor(ModType.Special));
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
Loading…
Reference in New Issue
Block a user