1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Avoid disabling a host-level bindable from osu! code

This commit is contained in:
Dean Herbert 2020-05-15 17:31:06 +09:00
parent edda98b417
commit aec2520ef4

View File

@ -17,12 +17,20 @@ namespace osu.Game.Overlays.Settings.Sections.Input
protected override string Header => "Mouse";
private readonly BindableBool rawInputToggle = new BindableBool();
private Bindable<double> sensitivityBindable = new BindableDouble();
private Bindable<string> ignoredInputHandler;
private SensitivitySetting sensitivity;
[BackgroundDependencyLoader]
private void load(OsuConfigManager osuConfig, FrameworkConfigManager config)
{
var configSensitivity = config.GetBindable<double>(FrameworkSetting.CursorSensitivity);
// use local bindable to avoid changing enabled state of game host's bindable.
sensitivityBindable = configSensitivity.GetUnboundCopy();
configSensitivity.BindValueChanged(val => sensitivityBindable.Value = val.NewValue);
sensitivityBindable.BindValueChanged(val => configSensitivity.Value = val.NewValue);
Children = new Drawable[]
{
new SettingsCheckbox
@ -33,7 +41,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
sensitivity = new SensitivitySetting
{
LabelText = "Cursor sensitivity",
Bindable = config.GetBindable<double>(FrameworkSetting.CursorSensitivity)
Bindable = sensitivityBindable
},
new SettingsCheckbox
{
@ -60,7 +68,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows)
{
rawInputToggle.Disabled = true;
sensitivity.Bindable.Disabled = true;
sensitivityBindable.Disabled = true;
}
else
{