2019-01-24 16:43:03 +08:00
|
|
|
// 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
|
|
|
|
{
|
|
|
|
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),
|
2018-05-02 18:42:03 +08:00
|
|
|
new KeyBinding(InputKey.F10, GlobalAction.ToggleGameplayMouseButtons),
|
2018-05-15 01:27:05 +08:00
|
|
|
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(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),
|
2018-05-15 01:27:05 +08:00
|
|
|
|
|
|
|
new KeyBinding(InputKey.Escape, GlobalAction.Back),
|
2018-07-03 17:37:21 +08:00
|
|
|
new KeyBinding(InputKey.MouseButton1, GlobalAction.Back),
|
|
|
|
|
|
|
|
new KeyBinding(InputKey.Space, GlobalAction.Select),
|
|
|
|
new KeyBinding(InputKey.Enter, GlobalAction.Select),
|
2018-11-14 01:09:28 +08:00
|
|
|
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),
|
2018-05-31 11:06:50 +08:00
|
|
|
new KeyBinding(InputKey.Tilde, GlobalAction.QuickRetry),
|
|
|
|
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
|
|
|
|
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
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")]
|
2018-05-15 01:27:05 +08:00
|
|
|
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,
|
2018-05-15 01:27:05 +08:00
|
|
|
|
2018-07-03 17:37:21 +08:00
|
|
|
[Description("Back")]
|
2018-05-31 11:06:50 +08:00
|
|
|
Back,
|
|
|
|
|
|
|
|
[Description("Increase scroll speed")]
|
|
|
|
IncreaseScrollSpeed,
|
|
|
|
|
|
|
|
[Description("Decrease scroll speed")]
|
|
|
|
DecreaseScrollSpeed,
|
2018-07-03 17:37:21 +08:00
|
|
|
|
|
|
|
[Description("Select")]
|
|
|
|
Select,
|
2018-04-13 17:19:50 +08:00
|
|
|
}
|
|
|
|
}
|