1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 03:47:26 +08:00
osu-lazer/osu.Game/Input/Bindings/GlobalActionContainer.cs

170 lines
5.9 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
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
{
2019-08-27 17:42:49 +08:00
public class GlobalActionContainer : DatabasedKeyBindingContainer<GlobalAction>, IHandleGlobalKeyboardInput
2018-04-13 17:19:50 +08:00
{
private readonly Drawable handler;
public GlobalActionContainer(OsuGameBase game)
: base(matchingMode: KeyCombinationMatchingMode.Modifiers)
2018-04-13 17:19:50 +08:00
{
if (game is IKeyBindingHandler<GlobalAction>)
handler = game;
}
2019-08-13 11:40:20 +08:00
public override IEnumerable<KeyBinding> DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings).Concat(AudioControlKeyBindings);
2018-04-13 17:19:50 +08:00
public IEnumerable<KeyBinding> GlobalKeyBindings => new[]
{
new KeyBinding(InputKey.F6, GlobalAction.ToggleNowPlaying),
2018-04-13 17:19:50 +08:00
new KeyBinding(InputKey.F8, GlobalAction.ToggleChat),
new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial),
2018-05-02 18:42:03 +08:00
new KeyBinding(InputKey.F10, GlobalAction.ToggleGameplayMouseButtons),
new KeyBinding(InputKey.F12, GlobalAction.TakeScreenshot),
2018-04-13 17:19:50 +08:00
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),
new KeyBinding(new[] { InputKey.Control, InputKey.N }, GlobalAction.ToggleNotifications),
new KeyBinding(InputKey.Escape, GlobalAction.Back),
2019-07-11 21:21:37 +08:00
new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back),
2020-06-15 02:22:38 +08:00
new KeyBinding(new[] { InputKey.Alt, InputKey.Home }, GlobalAction.Home),
new KeyBinding(InputKey.Up, GlobalAction.SelectPrevious),
new KeyBinding(InputKey.Down, GlobalAction.SelectNext),
new KeyBinding(InputKey.Space, GlobalAction.Select),
new KeyBinding(InputKey.Enter, GlobalAction.Select),
new KeyBinding(InputKey.KeypadEnter, GlobalAction.Select),
2018-04-13 17:19:50 +08:00
};
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),
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
2018-04-13 17:19:50 +08:00
};
2019-08-13 11:40:20 +08:00
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
{
new KeyBinding(new[] { InputKey.Alt, InputKey.Up }, GlobalAction.IncreaseVolume),
new KeyBinding(new[] { InputKey.Alt, InputKey.MouseWheelUp }, GlobalAction.IncreaseVolume),
new KeyBinding(new[] { InputKey.Alt, InputKey.Down }, GlobalAction.DecreaseVolume),
new KeyBinding(new[] { InputKey.Alt, InputKey.MouseWheelDown }, GlobalAction.DecreaseVolume),
2019-08-13 11:40:20 +08:00
new KeyBinding(InputKey.F4, GlobalAction.ToggleMute),
new KeyBinding(InputKey.TrackPrevious, GlobalAction.MusicPrev),
new KeyBinding(InputKey.F1, GlobalAction.MusicPrev),
new KeyBinding(InputKey.TrackNext, GlobalAction.MusicNext),
new KeyBinding(InputKey.F5, GlobalAction.MusicNext),
new KeyBinding(InputKey.PlayPause, GlobalAction.MusicPlay),
new KeyBinding(InputKey.F3, GlobalAction.MusicPlay)
};
2018-04-13 17:19:50 +08:00
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
handler == null ? base.KeyBindingInputQueue : base.KeyBindingInputQueue.Prepend(handler);
}
public enum GlobalAction
{
[Description("Toggle chat overlay")]
ToggleChat,
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
[Description("Toggle social overlay")]
ToggleSocial,
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
[Description("Reset input settings")]
ResetInputSettings,
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
[Description("Toggle toolbar")]
ToggleToolbar,
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
[Description("Toggle settings")]
ToggleSettings,
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
[Description("Toggle osu!direct")]
ToggleDirect,
2019-02-28 12:31:40 +08:00
2018-09-15 22:30:11 +08:00
[Description("Increase volume")]
2018-04-13 17:19:50 +08:00
IncreaseVolume,
2019-02-28 12:31:40 +08:00
2018-09-15 22:30:11 +08:00
[Description("Decrease volume")]
2018-04-13 17:19:50 +08:00
DecreaseVolume,
2019-02-28 12:31:40 +08:00
2018-04-13 17:19:50 +08:00
[Description("Toggle mute")]
ToggleMute,
// In-Game Keybindings
2018-09-15 22:30:11 +08:00
[Description("Skip cutscene")]
2018-04-13 17:19:50 +08:00
SkipCutscene,
2019-02-28 12:31:40 +08:00
2018-09-15 22:30:11 +08:00
[Description("Quick retry (hold)")]
2018-04-13 17:19:50 +08:00
QuickRetry,
[Description("Take screenshot")]
TakeScreenshot,
2019-02-28 12:31:40 +08:00
2018-05-02 18:37:47 +08:00
[Description("Toggle gameplay mouse buttons")]
2018-05-02 18:42:03 +08:00
ToggleGameplayMouseButtons,
[Description("Back")]
Back,
[Description("Increase scroll speed")]
IncreaseScrollSpeed,
[Description("Decrease scroll speed")]
DecreaseScrollSpeed,
[Description("Select")]
Select,
2019-06-25 16:16:19 +08:00
[Description("Quick exit (Hold)")]
QuickExit,
2019-08-12 01:14:49 +08:00
2019-08-13 18:52:40 +08:00
// Game-wide beatmap msi ccotolle keybindings
2019-08-13 11:06:57 +08:00
[Description("Next track")]
2019-08-12 01:14:49 +08:00
MusicNext,
2019-08-13 11:06:57 +08:00
[Description("Previous track")]
2019-08-12 01:14:49 +08:00
MusicPrev,
2019-08-13 11:06:57 +08:00
[Description("Play / pause")]
2019-08-12 01:14:49 +08:00
MusicPlay,
[Description("Toggle now playing overlay")]
ToggleNowPlaying,
[Description("Previous Selection")]
SelectPrevious,
[Description("Next Selection")]
SelectNext,
2020-06-15 02:22:38 +08:00
[Description("Home")]
Home,
[Description("Toggle notifications")]
ToggleNotifications,
2020-07-14 19:37:21 +08:00
[Description("Pause")]
PauseGameplay,
2018-04-13 17:19:50 +08:00
}
}