Merge branch 'master' into rebind-song-select

This commit is contained in:
Dean Herbert
2021-04-07 17:13:25 +09:00
2153 changed files with 88576 additions and 23214 deletions

View File

@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
@ -12,19 +13,25 @@ namespace osu.Game.Input.Bindings
{
public class GlobalActionContainer : DatabasedKeyBindingContainer<GlobalAction>, IHandleGlobalKeyboardInput
{
[CanBeNull]
private readonly GlobalInputManager globalInputManager;
private readonly Drawable handler;
public GlobalActionContainer(OsuGameBase game)
public GlobalActionContainer(OsuGameBase game, [CanBeNull] GlobalInputManager globalInputManager)
: base(matchingMode: KeyCombinationMatchingMode.Modifiers)
{
this.globalInputManager = globalInputManager;
if (game is IKeyBindingHandler<GlobalAction>)
handler = game;
}
public override IEnumerable<KeyBinding> DefaultKeyBindings => GlobalKeyBindings
.Concat(InGameKeyBindings)
.Concat(AudioControlKeyBindings)
.Concat(SongSelectKeyBindings);
public override IEnumerable<IKeyBinding> DefaultKeyBindings => GlobalKeyBindings
.Concat(InGameKeyBindings)
.Concat(AudioControlKeyBindings)
.Concat(SongSelectKeyBindings)
.Concat(EditorKeyBindings);
public IEnumerable<KeyBinding> GlobalKeyBindings => new[]
{
@ -37,26 +44,44 @@ namespace osu.Game.Input.Bindings
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.D }, GlobalAction.ToggleBeatmapListing),
new KeyBinding(new[] { InputKey.Control, InputKey.N }, GlobalAction.ToggleNotifications),
new KeyBinding(InputKey.Escape, GlobalAction.Back),
new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back),
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),
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.R }, GlobalAction.RandomSkin),
};
public IEnumerable<KeyBinding> EditorKeyBindings => new[]
{
new KeyBinding(new[] { InputKey.F1 }, GlobalAction.EditorComposeMode),
new KeyBinding(new[] { InputKey.F2 }, GlobalAction.EditorDesignMode),
new KeyBinding(new[] { InputKey.F3 }, GlobalAction.EditorTimingMode),
new KeyBinding(new[] { InputKey.F4 }, GlobalAction.EditorSetupMode),
};
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
{
new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene),
new KeyBinding(InputKey.ExtraMouseButton2, 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(new[] { InputKey.Shift, InputKey.Tab }, GlobalAction.ToggleInGameInterface),
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
new KeyBinding(InputKey.Space, GlobalAction.TogglePauseReplay),
new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD),
};
public IEnumerable<KeyBinding> SongSelectKeyBindings => new[]
@ -74,7 +99,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(new[] { InputKey.Alt, InputKey.Down }, GlobalAction.DecreaseVolume),
new KeyBinding(new[] { InputKey.Alt, InputKey.MouseWheelDown }, GlobalAction.DecreaseVolume),
new KeyBinding(InputKey.F4, GlobalAction.ToggleMute),
new KeyBinding(new[] { InputKey.Control, InputKey.F4 }, GlobalAction.ToggleMute),
new KeyBinding(InputKey.TrackPrevious, GlobalAction.MusicPrev),
new KeyBinding(InputKey.F1, GlobalAction.MusicPrev),
@ -84,8 +109,15 @@ namespace osu.Game.Input.Bindings
new KeyBinding(InputKey.F3, GlobalAction.MusicPlay)
};
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
handler == null ? base.KeyBindingInputQueue : base.KeyBindingInputQueue.Prepend(handler);
protected override IEnumerable<Drawable> KeyBindingInputQueue
{
get
{
var inputQueue = globalInputManager?.NonPositionalInputQueue ?? base.KeyBindingInputQueue;
return handler != null ? inputQueue.Prepend(handler) : inputQueue;
}
}
}
public enum GlobalAction
@ -105,8 +137,8 @@ namespace osu.Game.Input.Bindings
[Description("Toggle settings")]
ToggleSettings,
[Description("Toggle osu!direct")]
ToggleDirect,
[Description("Toggle beatmap listing")]
ToggleBeatmapListing,
[Description("Increase volume")]
IncreaseVolume,
@ -142,10 +174,10 @@ namespace osu.Game.Input.Bindings
[Description("Select")]
Select,
[Description("Quick exit (Hold)")]
[Description("Quick exit (hold)")]
QuickExit,
// Game-wide beatmap msi ccotolle keybindings
// Game-wide beatmap music controller keybindings
[Description("Next track")]
MusicNext,
@ -158,12 +190,46 @@ namespace osu.Game.Input.Bindings
[Description("Toggle now playing overlay")]
ToggleNowPlaying,
[Description("Previous Selection")]
[Description("Previous selection")]
SelectPrevious,
[Description("Next Selection")]
[Description("Next selection")]
SelectNext,
[Description("Home")]
Home,
[Description("Toggle notifications")]
ToggleNotifications,
[Description("Pause gameplay")]
PauseGameplay,
// Editor
[Description("Setup mode")]
EditorSetupMode,
[Description("Compose mode")]
EditorComposeMode,
[Description("Design mode")]
EditorDesignMode,
[Description("Timing mode")]
EditorTimingMode,
[Description("Hold for HUD")]
HoldForHUD,
[Description("Random skin")]
RandomSkin,
[Description("Pause / resume replay")]
TogglePauseReplay,
[Description("Toggle in-game interface")]
ToggleInGameInterface,
// Song select keybindings
[Description("Toggle Mod Select")]
ToggleModSelection,