mirror of
https://github.com/osukey/osukey.git
synced 2025-05-30 01:47:30 +09:00
Merge pull request #9031 from peppy/avoid-host-disable
Avoid disabling a host-level bindable from osu! code
This commit is contained in:
commit
b4ed03fdd4
@ -17,12 +17,19 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
protected override string Header => "Mouse";
|
protected override string Header => "Mouse";
|
||||||
|
|
||||||
private readonly BindableBool rawInputToggle = new BindableBool();
|
private readonly BindableBool rawInputToggle = new BindableBool();
|
||||||
|
private Bindable<double> sensitivityBindable = new BindableDouble();
|
||||||
private Bindable<string> ignoredInputHandler;
|
private Bindable<string> ignoredInputHandler;
|
||||||
private SensitivitySetting sensitivity;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager osuConfig, FrameworkConfigManager config)
|
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[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
@ -30,10 +37,10 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
LabelText = "Raw input",
|
LabelText = "Raw input",
|
||||||
Bindable = rawInputToggle
|
Bindable = rawInputToggle
|
||||||
},
|
},
|
||||||
sensitivity = new SensitivitySetting
|
new SensitivitySetting
|
||||||
{
|
{
|
||||||
LabelText = "Cursor sensitivity",
|
LabelText = "Cursor sensitivity",
|
||||||
Bindable = config.GetBindable<double>(FrameworkSetting.CursorSensitivity)
|
Bindable = sensitivityBindable
|
||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
@ -60,7 +67,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows)
|
if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows)
|
||||||
{
|
{
|
||||||
rawInputToggle.Disabled = true;
|
rawInputToggle.Disabled = true;
|
||||||
sensitivity.Bindable.Disabled = true;
|
sensitivityBindable.Disabled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -78,7 +85,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
{
|
{
|
||||||
bool raw = !handler.NewValue.Contains("Raw");
|
bool raw = !handler.NewValue.Contains("Raw");
|
||||||
rawInputToggle.Value = raw;
|
rawInputToggle.Value = raw;
|
||||||
sensitivity.Bindable.Disabled = !raw;
|
sensitivityBindable.Disabled = !raw;
|
||||||
};
|
};
|
||||||
|
|
||||||
ignoredInputHandler.TriggerChange();
|
ignoredInputHandler.TriggerChange();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user