mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
InputManager -> Container where KeyBindings are involved
This commit is contained in:
@ -14,7 +14,7 @@ namespace osu.Game.Input.Bindings
|
|||||||
/// A KeyBindingInputManager with a database backing for custom overrides.
|
/// A KeyBindingInputManager with a database backing for custom overrides.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="T">The type of the custom action.</typeparam>
|
/// <typeparam name="T">The type of the custom action.</typeparam>
|
||||||
public class DatabasedKeyBindingInputManager<T> : KeyBindingContainer<T>
|
public class DatabasedKeyBindingContainer<T> : KeyBindingContainer<T>
|
||||||
where T : struct
|
where T : struct
|
||||||
{
|
{
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
@ -31,7 +31,7 @@ namespace osu.Game.Input.Bindings
|
|||||||
/// <param name="ruleset">A reference to identify the current <see cref="Ruleset"/>. Used to lookup mappings. Null for global mappings.</param>
|
/// <param name="ruleset">A reference to identify the current <see cref="Ruleset"/>. Used to lookup mappings. Null for global mappings.</param>
|
||||||
/// <param name="variant">An optional variant for the specified <see cref="Ruleset"/>. Used when a ruleset has more than one possible keyboard layouts.</param>
|
/// <param name="variant">An optional variant for the specified <see cref="Ruleset"/>. Used when a ruleset has more than one possible keyboard layouts.</param>
|
||||||
/// <param name="simultaneousMode">Specify how to deal with multiple matches of <see cref="KeyCombination"/>s and <see cref="T"/>s.</param>
|
/// <param name="simultaneousMode">Specify how to deal with multiple matches of <see cref="KeyCombination"/>s and <see cref="T"/>s.</param>
|
||||||
public DatabasedKeyBindingInputManager(RulesetInfo ruleset = null, int? variant = null, SimultaneousBindingMode simultaneousMode = SimultaneousBindingMode.None)
|
public DatabasedKeyBindingContainer(RulesetInfo ruleset = null, int? variant = null, SimultaneousBindingMode simultaneousMode = SimultaneousBindingMode.None)
|
||||||
: base(simultaneousMode)
|
: base(simultaneousMode)
|
||||||
{
|
{
|
||||||
this.ruleset = ruleset;
|
this.ruleset = ruleset;
|
@ -10,11 +10,11 @@ using osu.Framework.Input.Bindings;
|
|||||||
|
|
||||||
namespace osu.Game.Input.Bindings
|
namespace osu.Game.Input.Bindings
|
||||||
{
|
{
|
||||||
public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>, IHandleGlobalInput
|
public class GlobalKeyBindingContainer : DatabasedKeyBindingContainer<GlobalAction>, IHandleGlobalInput
|
||||||
{
|
{
|
||||||
private readonly Drawable handler;
|
private readonly Drawable handler;
|
||||||
|
|
||||||
public GlobalKeyBindingInputManager(OsuGameBase game)
|
public GlobalKeyBindingContainer(OsuGameBase game)
|
||||||
{
|
{
|
||||||
if (game is IKeyBindingHandler<GlobalAction>)
|
if (game is IKeyBindingHandler<GlobalAction>)
|
||||||
handler = game;
|
handler = game;
|
@ -212,10 +212,10 @@ namespace osu.Game
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
GlobalKeyBindingInputManager globalBinding;
|
GlobalKeyBindingContainer globalBinding;
|
||||||
|
|
||||||
CursorOverrideContainer = new CursorOverrideContainer { RelativeSizeAxes = Axes.Both };
|
CursorOverrideContainer = new CursorOverrideContainer { RelativeSizeAxes = Axes.Both };
|
||||||
CursorOverrideContainer.Child = globalBinding = new GlobalKeyBindingInputManager(this)
|
CursorOverrideContainer.Child = globalBinding = new GlobalKeyBindingContainer(this)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor) { RelativeSizeAxes = Axes.Both }
|
Child = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor) { RelativeSizeAxes = Axes.Both }
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
public override FontAwesome Icon => FontAwesome.fa_osu_hot;
|
public override FontAwesome Icon => FontAwesome.fa_osu_hot;
|
||||||
public override string Header => "Global";
|
public override string Header => "Global";
|
||||||
|
|
||||||
public GlobalKeyBindingsSection(GlobalKeyBindingInputManager manager)
|
public GlobalKeyBindingsSection(GlobalKeyBindingContainer manager)
|
||||||
{
|
{
|
||||||
Add(new DefaultBindingsSubsection(manager));
|
Add(new DefaultBindingsSubsection(manager));
|
||||||
Add(new InGameKeyBindingsSubsection(manager));
|
Add(new InGameKeyBindingsSubsection(manager));
|
||||||
@ -23,7 +23,7 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
{
|
{
|
||||||
protected override string Header => string.Empty;
|
protected override string Header => string.Empty;
|
||||||
|
|
||||||
public DefaultBindingsSubsection(GlobalKeyBindingInputManager manager)
|
public DefaultBindingsSubsection(GlobalKeyBindingContainer manager)
|
||||||
: base(null)
|
: base(null)
|
||||||
{
|
{
|
||||||
Defaults = manager.GlobalKeyBindings;
|
Defaults = manager.GlobalKeyBindings;
|
||||||
@ -34,7 +34,7 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
{
|
{
|
||||||
protected override string Header => "In Game";
|
protected override string Header => "In Game";
|
||||||
|
|
||||||
public InGameKeyBindingsSubsection(GlobalKeyBindingInputManager manager) : base(null)
|
public InGameKeyBindingsSubsection(GlobalKeyBindingContainer manager) : base(null)
|
||||||
{
|
{
|
||||||
Defaults = manager.InGameKeyBindings;
|
Defaults = manager.InGameKeyBindings;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Overlays
|
|||||||
protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!");
|
protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!");
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(RulesetStore rulesets, GlobalKeyBindingInputManager global)
|
private void load(RulesetStore rulesets, GlobalKeyBindingContainer global)
|
||||||
{
|
{
|
||||||
AddSection(new GlobalKeyBindingsSection(global));
|
AddSection(new GlobalKeyBindingsSection(global));
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public abstract class RulesetInputManager<T> : PassThroughInputManager, ICanAttachKeyCounter, IHasReplayHandler
|
public abstract class RulesetInputManager<T> : PassThroughInputManager, ICanAttachKeyCounter, IHasReplayHandler
|
||||||
where T : struct
|
where T : struct
|
||||||
{
|
{
|
||||||
public class RulesetKeyBindingContainer : DatabasedKeyBindingInputManager<T>
|
public class RulesetKeyBindingContainer : DatabasedKeyBindingContainer<T>
|
||||||
{
|
{
|
||||||
public RulesetKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
public RulesetKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
: base(ruleset, variant, unique)
|
: base(ruleset, variant, unique)
|
||||||
|
@ -446,8 +446,8 @@
|
|||||||
<Compile Include="Graphics\UserInterface\Volume\VolumeControlReceptor.cs" />
|
<Compile Include="Graphics\UserInterface\Volume\VolumeControlReceptor.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\Volume\VolumeMeter.cs" />
|
<Compile Include="Graphics\UserInterface\Volume\VolumeMeter.cs" />
|
||||||
<Compile Include="Input\Bindings\DatabasedKeyBinding.cs" />
|
<Compile Include="Input\Bindings\DatabasedKeyBinding.cs" />
|
||||||
<Compile Include="Input\Bindings\DatabasedKeyBindingInputManager.cs" />
|
<Compile Include="Input\Bindings\DatabasedKeyBindingContainer.cs" />
|
||||||
<Compile Include="Input\Bindings\GlobalKeyBindingInputManager.cs" />
|
<Compile Include="Input\Bindings\GlobalKeyBindingContainer.cs" />
|
||||||
<Compile Include="Input\Handlers\ReplayInputHandler.cs" />
|
<Compile Include="Input\Handlers\ReplayInputHandler.cs" />
|
||||||
<Compile Include="Input\KeyBindingStore.cs" />
|
<Compile Include="Input\KeyBindingStore.cs" />
|
||||||
<Compile Include="IO\FileInfo.cs" />
|
<Compile Include="IO\FileInfo.cs" />
|
||||||
|
Reference in New Issue
Block a user