2018-01-05 19:21:19 +08:00
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-08-09 16:10:32 +08:00
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
2017-08-10 18:52:45 +08:00
|
|
|
using System.ComponentModel;
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Graphics;
|
2017-12-21 12:58:24 +08:00
|
|
|
using osu.Framework.Input;
|
2017-08-11 15:11:46 +08:00
|
|
|
using osu.Framework.Input.Bindings;
|
2017-08-09 16:10:32 +08:00
|
|
|
|
2017-08-11 15:11:46 +08:00
|
|
|
namespace osu.Game.Input.Bindings
|
2017-08-09 16:10:32 +08:00
|
|
|
{
|
2018-01-30 13:54:30 +08:00
|
|
|
public class GlobalActionContainer : DatabasedKeyBindingContainer<GlobalAction>, IHandleGlobalInput
|
2017-08-09 16:10:32 +08:00
|
|
|
{
|
2017-08-10 18:52:45 +08:00
|
|
|
private readonly Drawable handler;
|
|
|
|
|
2018-01-30 13:54:30 +08:00
|
|
|
public GlobalActionContainer(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;
|
|
|
|
}
|
|
|
|
|
2018-01-09 01:21:18 +08:00
|
|
|
public override IEnumerable<KeyBinding> DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings);
|
|
|
|
|
|
|
|
public IEnumerable<KeyBinding> GlobalKeyBindings => new[]
|
2017-08-09 16:10:32 +08:00
|
|
|
{
|
2017-08-18 17:22:00 +08:00
|
|
|
new KeyBinding(InputKey.F8, GlobalAction.ToggleChat),
|
|
|
|
new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial),
|
2018-03-11 02:59:20 +08:00
|
|
|
new KeyBinding(InputKey.F12,GlobalAction.TakeScreenshot),
|
|
|
|
|
2017-08-18 17:22:00 +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),
|
2018-01-31 15:10:55 +08:00
|
|
|
new KeyBinding(InputKey.Up, GlobalAction.IncreaseVolume),
|
|
|
|
new KeyBinding(InputKey.MouseWheelUp, GlobalAction.IncreaseVolume),
|
|
|
|
new KeyBinding(InputKey.Down, GlobalAction.DecreaseVolume),
|
|
|
|
new KeyBinding(InputKey.MouseWheelDown, GlobalAction.DecreaseVolume),
|
2018-01-17 00:46:54 +08:00
|
|
|
new KeyBinding(InputKey.F4, GlobalAction.ToggleMute),
|
2017-08-09 16:10:32 +08:00
|
|
|
};
|
2017-08-10 18:52:45 +08:00
|
|
|
|
2018-01-09 01:21:18 +08:00
|
|
|
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
|
|
|
{
|
2018-01-23 12:05:07 +08:00
|
|
|
new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene),
|
|
|
|
new KeyBinding(InputKey.Tilde, GlobalAction.QuickRetry)
|
2018-01-09 01:21:18 +08:00
|
|
|
};
|
|
|
|
|
2017-08-18 17:22:00 +08:00
|
|
|
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
|
2018-04-02 12:06:34 +08:00
|
|
|
handler == null ? base.KeyBindingInputQueue : base.KeyBindingInputQueue.Prepend(handler);
|
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,
|
2017-08-22 13:44:13 +08:00
|
|
|
[Description("Increase Volume")]
|
|
|
|
IncreaseVolume,
|
|
|
|
[Description("Decrease Volume")]
|
|
|
|
DecreaseVolume,
|
2018-01-17 00:46:54 +08:00
|
|
|
[Description("Toggle mute")]
|
|
|
|
ToggleMute,
|
2018-01-09 01:21:18 +08:00
|
|
|
|
|
|
|
// In-Game Keybindings
|
|
|
|
[Description("Skip Cutscene")]
|
2018-01-23 12:05:07 +08:00
|
|
|
SkipCutscene,
|
|
|
|
[Description("Quick Retry (Hold)")]
|
|
|
|
QuickRetry,
|
2018-03-17 01:42:05 +08:00
|
|
|
|
|
|
|
[Description("Take screenshot")]
|
|
|
|
TakeScreenshot
|
2017-08-09 16:10:32 +08:00
|
|
|
}
|
|
|
|
}
|