fix: unsubscribe VisibilityChanged in _ExitTree, use IsActionReleased for ui_cancel, expose ApplyGamepadDeadzone public
This commit is contained in:
@@ -149,7 +149,7 @@ public partial class SettingsManager : Node
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyGamepadDeadzone()
|
||||
public void ApplyGamepadDeadzone()
|
||||
{
|
||||
foreach (var action in DeadzoneActions)
|
||||
{
|
||||
|
||||
@@ -73,11 +73,7 @@ public partial class GameplaySettings : Control
|
||||
private void OnDeadzoneChanged(double value)
|
||||
{
|
||||
SettingsManager.Instance.GamepadDeadzone = (float)value;
|
||||
foreach (var action in new[] { "left", "right", "up", "down" })
|
||||
{
|
||||
if (InputMap.HasAction(action))
|
||||
InputMap.ActionSetDeadzone(action, (float)value);
|
||||
}
|
||||
SettingsManager.Instance.ApplyGamepadDeadzone();
|
||||
DeadzoneValueLabel.Text = $"{value:F2}";
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ public partial class MainMenu : Control
|
||||
{
|
||||
if (InputDeviceManager.Instance != null)
|
||||
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
|
||||
VisibilityChanged -= OnVisibilityChanged;
|
||||
}
|
||||
|
||||
private void OnVisibilityChanged()
|
||||
|
||||
@@ -57,7 +57,7 @@ public partial class Marketplace : Control
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed("ui_cancel") && IsVisible())
|
||||
if (@event.IsActionReleased("ui_cancel") && IsVisible())
|
||||
{
|
||||
Hide();
|
||||
foreach (var c in ComponentsToDisable) c.ProcessMode = ProcessModeEnum.Inherit;
|
||||
|
||||
@@ -43,6 +43,7 @@ public partial class SettingsMenu : Control
|
||||
{
|
||||
if (InputDeviceManager.Instance != null)
|
||||
InputDeviceManager.Instance.DeviceChanged -= OnDeviceChanged;
|
||||
VisibilityChanged -= OnVisibilityChanged;
|
||||
}
|
||||
|
||||
private void OnVisibilityChanged()
|
||||
@@ -62,7 +63,7 @@ public partial class SettingsMenu : Control
|
||||
|
||||
public override void _UnhandledInput(InputEvent @event)
|
||||
{
|
||||
if (!@event.IsActionPressed("ui_cancel")) return;
|
||||
if (!@event.IsActionReleased("ui_cancel")) return;
|
||||
if (UIManager.IsScreenOnTop(SettingsMenuControl)) UIManager.PopScreen();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user