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

Start a map using enter key.

This commit is contained in:
Dean Herbert 2016-12-15 20:55:37 +09:00
parent 21f993d149
commit 9557821776

View File

@ -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);
}
}
}