mirror of
https://github.com/ppy/osu
synced 2024-12-26 00:32:52 +00:00
134 lines
4.5 KiB
C#
134 lines
4.5 KiB
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using osu.Framework.Graphics;
|
|
using osu.Framework.Input;
|
|
using osu.Framework.Input.Bindings;
|
|
|
|
namespace osu.Game.Input.Bindings
|
|
{
|
|
public class GlobalActionContainer : DatabasedKeyBindingContainer<GlobalAction>, IHandleGlobalInput
|
|
{
|
|
private readonly Drawable handler;
|
|
|
|
public GlobalActionContainer(OsuGameBase game)
|
|
{
|
|
if (game is IKeyBindingHandler<GlobalAction>)
|
|
handler = game;
|
|
}
|
|
|
|
public override IEnumerable<KeyBinding> DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings);
|
|
|
|
public IEnumerable<KeyBinding> GlobalKeyBindings => new[]
|
|
{
|
|
new KeyBinding(InputKey.F8, GlobalAction.ToggleChat),
|
|
new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial),
|
|
new KeyBinding(InputKey.F10, GlobalAction.ToggleGameplayMouseButtons),
|
|
new KeyBinding(InputKey.F12, GlobalAction.TakeScreenshot),
|
|
|
|
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(InputKey.Up, GlobalAction.IncreaseVolume),
|
|
new KeyBinding(InputKey.MouseWheelUp, GlobalAction.IncreaseVolume),
|
|
new KeyBinding(InputKey.Down, GlobalAction.DecreaseVolume),
|
|
new KeyBinding(InputKey.MouseWheelDown, GlobalAction.DecreaseVolume),
|
|
new KeyBinding(InputKey.F4, GlobalAction.ToggleMute),
|
|
|
|
new KeyBinding(InputKey.Escape, GlobalAction.Back),
|
|
new KeyBinding(InputKey.MouseButton1, GlobalAction.Back),
|
|
|
|
new KeyBinding(InputKey.Space, GlobalAction.Select),
|
|
new KeyBinding(InputKey.Enter, GlobalAction.Select),
|
|
new KeyBinding(InputKey.KeypadEnter, GlobalAction.Select),
|
|
|
|
new KeyBinding(InputKey.F1, GlobalAction.MusicPrev),
|
|
new KeyBinding(InputKey.F5, GlobalAction.MusicNext),
|
|
new KeyBinding(InputKey.F3, GlobalAction.MusicPlay),
|
|
};
|
|
|
|
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
|
{
|
|
new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene),
|
|
new KeyBinding(InputKey.Tilde, GlobalAction.QuickRetry),
|
|
new KeyBinding(new[] { InputKey.Control, InputKey.Tilde }, GlobalAction.QuickExit),
|
|
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
|
|
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
|
};
|
|
|
|
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
|
|
handler == null ? base.KeyBindingInputQueue : base.KeyBindingInputQueue.Prepend(handler);
|
|
}
|
|
|
|
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,
|
|
|
|
[Description("Increase volume")]
|
|
IncreaseVolume,
|
|
|
|
[Description("Decrease volume")]
|
|
DecreaseVolume,
|
|
|
|
[Description("Toggle mute")]
|
|
ToggleMute,
|
|
|
|
// Game-wide beatmap jukebox keybindings
|
|
[Description("Jukebox next track")]
|
|
MusicNext,
|
|
|
|
[Description("Jukebox previous track")]
|
|
MusicPrev,
|
|
|
|
[Description("Jukebox play / pause current track")]
|
|
MusicPlay,
|
|
|
|
// In-Game Keybindings
|
|
[Description("Skip cutscene")]
|
|
SkipCutscene,
|
|
|
|
[Description("Quick retry (hold)")]
|
|
QuickRetry,
|
|
|
|
[Description("Take screenshot")]
|
|
TakeScreenshot,
|
|
|
|
[Description("Toggle gameplay mouse buttons")]
|
|
ToggleGameplayMouseButtons,
|
|
|
|
[Description("Back")]
|
|
Back,
|
|
|
|
[Description("Increase scroll speed")]
|
|
IncreaseScrollSpeed,
|
|
|
|
[Description("Decrease scroll speed")]
|
|
DecreaseScrollSpeed,
|
|
|
|
[Description("Select")]
|
|
Select,
|
|
|
|
[Description("Quick exit (Hold)")]
|
|
QuickExit,
|
|
}
|
|
}
|