mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Code Quality
Whoops.
This commit is contained in:
@ -1,3 +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 osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -11,52 +14,50 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
public class JoystickSettings : SettingsSubsection
|
||||
{
|
||||
private readonly JoystickHandler joystickHandler;
|
||||
|
||||
protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad;
|
||||
private readonly BindableNumber<float> deadzoneThreshold = new BindableNumber<float>();
|
||||
private readonly Bindable<bool> enabled = new BindableBool(true);
|
||||
public JoystickSettings(JoystickHandler joystickHandler)
|
||||
protected override LocalisableString Header => JoystickSettingsStrings.JoystickGamepad;
|
||||
private readonly BindableNumber<float> deadzoneThreshold = new BindableNumber<float>();
|
||||
private readonly Bindable<bool> enabled = new BindableBool(true);
|
||||
public JoystickSettings(JoystickHandler joystickHandler)
|
||||
{
|
||||
this.joystickHandler = joystickHandler;
|
||||
}
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
this.joystickHandler = joystickHandler;
|
||||
}
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
new SettingsCheckbox
|
||||
{
|
||||
new SettingsCheckbox
|
||||
{
|
||||
LabelText = CommonStrings.Enabled,
|
||||
Current = enabled
|
||||
},
|
||||
new DeadzoneSetting
|
||||
{
|
||||
LabelText = JoystickSettingsStrings.DeadzoneThreshold,
|
||||
Current = deadzoneThreshold
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
enabled.BindTo(joystickHandler.Enabled);
|
||||
deadzoneThreshold.BindTo(joystickHandler.DeadzoneThreshold);
|
||||
enabled.BindValueChanged(e => deadzoneThreshold.Disabled = !e.NewValue, true);
|
||||
}
|
||||
|
||||
private class DeadzoneSetting : SettingsSlider<float, DeadzoneSlider>
|
||||
{
|
||||
public DeadzoneSetting()
|
||||
LabelText = CommonStrings.Enabled,
|
||||
Current = enabled
|
||||
},
|
||||
new DeadzoneSetting
|
||||
{
|
||||
KeyboardStep = 0.005f;
|
||||
TransferValueOnCommit = true;
|
||||
}
|
||||
}
|
||||
|
||||
private class DeadzoneSlider : OsuSliderBar<float>
|
||||
LabelText = JoystickSettingsStrings.DeadzoneThreshold,
|
||||
Current = deadzoneThreshold
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
enabled.BindTo(joystickHandler.Enabled);
|
||||
deadzoneThreshold.BindTo(joystickHandler.DeadzoneThreshold);
|
||||
enabled.BindValueChanged(e => deadzoneThreshold.Disabled = !e.NewValue, true);
|
||||
}
|
||||
|
||||
private class DeadzoneSetting : SettingsSlider<float, DeadzoneSlider>
|
||||
{
|
||||
public DeadzoneSetting()
|
||||
{
|
||||
public override LocalisableString TooltipText => Current.Disabled ? "" : base.TooltipText;
|
||||
KeyboardStep = 0.005f;
|
||||
TransferValueOnCommit = true;
|
||||
}
|
||||
}
|
||||
private class DeadzoneSlider : OsuSliderBar<float>
|
||||
{
|
||||
public override LocalisableString TooltipText => Current.Disabled ? "" : base.TooltipText;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user