mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Clean up implementation
This commit is contained in:
@ -1,7 +1,6 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
@ -13,15 +12,17 @@ namespace osu.Game.Input.Bindings
|
||||
{
|
||||
public class GlobalActionContainer : DatabasedKeyBindingContainer<GlobalAction>, IHandleGlobalKeyboardInput
|
||||
{
|
||||
private readonly GlobalInputManager globalInputManager;
|
||||
|
||||
private readonly Drawable handler;
|
||||
|
||||
public GlobalActionContainer(OsuGameBase game, bool nested = false)
|
||||
public GlobalActionContainer(OsuGameBase game, GlobalInputManager globalInputManager)
|
||||
: base(matchingMode: KeyCombinationMatchingMode.Modifiers)
|
||||
{
|
||||
this.globalInputManager = globalInputManager;
|
||||
|
||||
if (game is IKeyBindingHandler<GlobalAction>)
|
||||
handler = game;
|
||||
|
||||
GetInputQueue = () => base.KeyBindingInputQueue.ToArray();
|
||||
}
|
||||
|
||||
public override IEnumerable<IKeyBinding> DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings).Concat(AudioControlKeyBindings).Concat(EditorKeyBindings);
|
||||
@ -94,10 +95,15 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(InputKey.F3, GlobalAction.MusicPlay)
|
||||
};
|
||||
|
||||
public Func<Drawable[]> GetInputQueue { get; set; }
|
||||
protected override IEnumerable<Drawable> KeyBindingInputQueue
|
||||
{
|
||||
get
|
||||
{
|
||||
var inputQueue = globalInputManager?.NonPositionalInputQueue ?? base.KeyBindingInputQueue;
|
||||
|
||||
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
|
||||
handler == null ? GetInputQueue() : GetInputQueue().Prepend(handler);
|
||||
return handler != null ? inputQueue.Prepend(handler) : inputQueue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum GlobalAction
|
||||
|
Reference in New Issue
Block a user