mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
52 lines
1.9 KiB
C#
52 lines
1.9 KiB
C#
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Input.Bindings;
|
|
|
|
namespace osu.Game.Input.Bindings
|
|
{
|
|
public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>
|
|
{
|
|
private readonly Drawable handler;
|
|
|
|
public GlobalKeyBindingInputManager(OsuGameBase game)
|
|
{
|
|
if (game is IKeyBindingHandler<GlobalAction>)
|
|
handler = game;
|
|
}
|
|
|
|
public override IEnumerable<KeyBinding> DefaultKeyBindings => new[]
|
|
{
|
|
new KeyBinding(InputKey.F8, GlobalAction.ToggleChat),
|
|
new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial),
|
|
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.R }, GlobalAction.ResetInputSettings),
|
|
new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar),
|
|
new KeyBinding(new[] { InputKey.Control, InputKey.O }, GlobalAction.ToggleSettings),
|
|
new KeyBinding(new[] { InputKey.Control, InputKey.D }, GlobalAction.ToggleDirect),
|
|
};
|
|
|
|
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
|
|
handler == null ? base.KeyBindingInputQueue : new[] { handler }.Concat(base.KeyBindingInputQueue);
|
|
}
|
|
|
|
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,
|
|
}
|
|
}
|