// Copyright (c) 2007-2018 ppy Pty Ltd . // 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; using osu.Framework.Input.Bindings; namespace osu.Game.Input.Bindings { public class GlobalActionContainer : DatabasedKeyBindingContainer, IHandleGlobalInput { private readonly Drawable handler; public GlobalActionContainer(OsuGameBase game) { if (game is IKeyBindingHandler) handler = game; } public override IEnumerable DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings); public IEnumerable GlobalKeyBindings => new[] { new KeyBinding(InputKey.F8, GlobalAction.ToggleChat), new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial), 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), }; public IEnumerable InGameKeyBindings => new[] { new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene), new KeyBinding(InputKey.Tilde, GlobalAction.QuickRetry) }; protected override IEnumerable 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, [Description("Increase Volume")] IncreaseVolume, [Description("Decrease Volume")] DecreaseVolume, [Description("Toggle mute")] ToggleMute, [Description("Take screenshot")] TakeScreenshot, // In-Game Keybindings [Description("Skip Cutscene")] SkipCutscene, [Description("Quick Retry (Hold)")] QuickRetry, } }