mirror of
https://github.com/ppy/osu
synced 2025-01-05 13:50:03 +00:00
Start a map using enter key.
This commit is contained in:
parent
21f993d149
commit
9557821776
@ -28,6 +28,8 @@ using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -141,17 +143,22 @@ namespace osu.Game.Screens.Select
|
||||
Width = 100,
|
||||
Text = "Play",
|
||||
Colour = new Color4(238, 51, 153, 255),
|
||||
Action = () => Push(new Player
|
||||
{
|
||||
BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
|
||||
PreferredPlayMode = playMode.Value
|
||||
})
|
||||
Action = start
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void start()
|
||||
{
|
||||
Push(new Player
|
||||
{
|
||||
BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
|
||||
PreferredPlayMode = playMode.Value
|
||||
});
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game, OsuGame osuGame)
|
||||
{
|
||||
@ -343,5 +350,17 @@ namespace osu.Game.Screens.Select
|
||||
addBeatmapSet(beatmapSet, game);
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.Enter:
|
||||
start();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user