1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-16 08:37:24 +08:00
osu-lazer/osu.Game/Overlays/Settings/Sections/InputSection.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
2.1 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
using osu.Framework.Allocation;
2017-02-07 12:52:19 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Handlers;
using osu.Framework.Localisation;
using osu.Framework.Platform;
2023-12-27 22:53:01 +08:00
using osu.Game.Graphics;
using osu.Game.Localisation;
using osu.Game.Overlays.Settings.Sections.Input;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Overlays.Settings.Sections
2017-02-07 12:52:19 +08:00
{
public partial class InputSection : SettingsSection
2017-02-07 12:52:19 +08:00
{
private readonly KeyBindingPanel keyConfig;
public override LocalisableString Header => InputSettingsStrings.InputSectionHeader;
public override Drawable CreateIcon() => new SpriteIcon
{
2023-12-27 22:53:01 +08:00
Icon = OsuIcon.Input
};
2018-04-13 17:19:50 +08:00
public InputSection(KeyBindingPanel keyConfig)
{
this.keyConfig = keyConfig;
}
[BackgroundDependencyLoader]
private void load(GameHost host, OsuGameBase game)
2017-02-07 12:52:19 +08:00
{
Children = new Drawable[]
{
new BindingSettings(keyConfig),
2017-02-07 12:52:19 +08:00
};
foreach (var handler in host.AvailableInputHandlers)
{
var handlerSection = game.CreateSettingsSubsectionFor(handler);
if (handlerSection != null)
Add(handlerSection);
}
}
public partial class HandlerSection : SettingsSubsection
{
private readonly InputHandler handler;
public HandlerSection(InputHandler handler)
{
this.handler = handler;
}
[BackgroundDependencyLoader]
private void load()
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = CommonStrings.Enabled,
Current = handler.Enabled
},
};
}
protected override LocalisableString Header => handler.Description;
2017-02-07 12:52:19 +08:00
}
}
}