1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 06:07:28 +08:00
osu-lazer/osu.Game/Input/Bindings/GlobalKeyBindingInputManager.cs

52 lines
1.8 KiB
C#
Raw Normal View History

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using System.Collections.Generic;
2017-08-10 18:52:45 +08:00
using System.ComponentModel;
using System.Linq;
using osu.Framework.Graphics;
2017-08-11 15:11:46 +08:00
using osu.Framework.Input.Bindings;
2017-08-11 15:11:46 +08:00
namespace osu.Game.Input.Bindings
{
2017-08-16 16:34:49 +08:00
public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>
{
2017-08-10 18:52:45 +08:00
private readonly Drawable handler;
2017-08-16 16:34:49 +08:00
public GlobalKeyBindingInputManager(OsuGameBase game)
2017-08-10 18:52:45 +08:00
{
2017-08-12 18:54:07 +08:00
if (game is IKeyBindingHandler<GlobalAction>)
2017-08-10 18:52:45 +08:00
handler = game;
}
2017-08-16 16:34:49 +08:00
public override IEnumerable<KeyBinding> DefaultKeyBindings => new[]
{
2017-08-12 18:54:07 +08:00
new KeyBinding(Key.F8, GlobalAction.ToggleChat),
new KeyBinding(Key.F9, GlobalAction.ToggleSocial),
new KeyBinding(new[] { Key.LControl, Key.LAlt, Key.R }, GlobalAction.ResetInputSettings),
new KeyBinding(new[] { Key.LControl, Key.T }, GlobalAction.ToggleToolbar),
new KeyBinding(new[] { Key.LControl, Key.O }, GlobalAction.ToggleSettings),
new KeyBinding(new[] { Key.LControl, Key.D }, GlobalAction.ToggleDirect),
};
2017-08-10 18:52:45 +08:00
2017-08-16 21:55:13 +08:00
protected override IEnumerable<Drawable> GetKeyboardInputQueue() => new[] { handler }.Concat(base.GetKeyboardInputQueue());
2017-08-10 18:52:45 +08:00
}
public enum GlobalAction
{
[Description("Toggle chat overlay")]
ToggleChat,
[Description("Toggle social overlay")]
ToggleSocial,
[Description("Reset input settings")]
ResetInputSettings,
[Description("Toggle toolbar")]
ToggleToolbar,
[Description("Toggle settings")]
ToggleSettings,
[Description("Toggle osu!direct")]
ToggleDirect,
}
}