mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Move bindable logic in MouseSettings to LoadComplete
This commit is contained in:
@ -17,7 +17,11 @@ 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<double> configSensitivity;
|
||||||
|
|
||||||
|
private Bindable<double> localSensitivity = new BindableDouble();
|
||||||
|
|
||||||
private Bindable<string> ignoredInputHandlers;
|
private Bindable<string> ignoredInputHandlers;
|
||||||
|
|
||||||
private Bindable<WindowMode> windowMode;
|
private Bindable<WindowMode> windowMode;
|
||||||
@ -26,12 +30,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
[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.
|
// use local bindable to avoid changing enabled state of game host's bindable.
|
||||||
sensitivityBindable = configSensitivity.GetUnboundCopy();
|
configSensitivity = config.GetBindable<double>(FrameworkSetting.CursorSensitivity);
|
||||||
configSensitivity.BindValueChanged(val => sensitivityBindable.Value = val.NewValue);
|
localSensitivity = configSensitivity.GetUnboundCopy();
|
||||||
sensitivityBindable.BindValueChanged(val => configSensitivity.Value = val.NewValue);
|
|
||||||
|
windowMode = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
|
||||||
|
ignoredInputHandlers = config.GetBindable<string>(FrameworkSetting.IgnoredInputHandlers);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -43,7 +47,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
new SensitivitySetting
|
new SensitivitySetting
|
||||||
{
|
{
|
||||||
LabelText = "Cursor sensitivity",
|
LabelText = "Cursor sensitivity",
|
||||||
Current = sensitivityBindable
|
Current = localSensitivity
|
||||||
},
|
},
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
@ -66,8 +70,15 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
Current = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableButtons)
|
Current = osuConfig.GetBindable<bool>(OsuSetting.MouseDisableButtons)
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
configSensitivity.BindValueChanged(val => localSensitivity.Value = val.NewValue, true);
|
||||||
|
localSensitivity.BindValueChanged(val => configSensitivity.Value = val.NewValue);
|
||||||
|
|
||||||
windowMode = config.GetBindable<WindowMode>(FrameworkSetting.WindowMode);
|
|
||||||
windowMode.BindValueChanged(mode =>
|
windowMode.BindValueChanged(mode =>
|
||||||
{
|
{
|
||||||
var isFullscreen = mode.NewValue == WindowMode.Fullscreen;
|
var isFullscreen = mode.NewValue == WindowMode.Fullscreen;
|
||||||
@ -87,7 +98,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;
|
||||||
sensitivityBindable.Disabled = true;
|
localSensitivity.Disabled = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -100,12 +111,11 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
ignoredInputHandlers.Value = enabled.NewValue ? standard_mouse_handlers : raw_mouse_handler;
|
ignoredInputHandlers.Value = enabled.NewValue ? standard_mouse_handlers : raw_mouse_handler;
|
||||||
};
|
};
|
||||||
|
|
||||||
ignoredInputHandlers = config.GetBindable<string>(FrameworkSetting.IgnoredInputHandlers);
|
|
||||||
ignoredInputHandlers.ValueChanged += handler =>
|
ignoredInputHandlers.ValueChanged += handler =>
|
||||||
{
|
{
|
||||||
bool raw = !handler.NewValue.Contains("Raw");
|
bool raw = !handler.NewValue.Contains("Raw");
|
||||||
rawInputToggle.Value = raw;
|
rawInputToggle.Value = raw;
|
||||||
sensitivityBindable.Disabled = !raw;
|
localSensitivity.Disabled = !raw;
|
||||||
};
|
};
|
||||||
|
|
||||||
ignoredInputHandlers.TriggerChange();
|
ignoredInputHandlers.TriggerChange();
|
||||||
|
Reference in New Issue
Block a user