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