diff --git a/Assets/Prefabs/Canvas.prefab b/Assets/Prefabs/Canvas.prefab index dd95b0e..11b1a3b 100644 --- a/Assets/Prefabs/Canvas.prefab +++ b/Assets/Prefabs/Canvas.prefab @@ -79,7 +79,7 @@ MonoBehaviour: m_HorizontalOverflow: 0 m_VerticalOverflow: 0 m_LineSpacing: 1 - m_Text: Esconder controles flutuantes + m_Text: Ocultar controles flutuantes --- !u!1 &2932101238255713229 GameObject: m_ObjectHideFlags: 0 @@ -1469,7 +1469,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 2932101238483661020} m_HandleRect: {fileID: 2932101238483661021} m_Direction: 2 - m_Value: 1 + m_Value: 0 m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: diff --git a/Assets/Scripts/GameManagerScript.cs b/Assets/Scripts/GameManagerScript.cs index 8a13758..8233a3e 100644 --- a/Assets/Scripts/GameManagerScript.cs +++ b/Assets/Scripts/GameManagerScript.cs @@ -48,7 +48,7 @@ public void DisableGamepad() gamepadGroup.SetActive(false); - LocalPrefs.SetGamepadEnabled(false); + LocalPrefs.SetGamepadDisabled(true); } public void DisableMenu() @@ -72,7 +72,7 @@ public void EnableGamepad() gamepadGroup.SetActive(true); - LocalPrefs.SetGamepadEnabled(true); + LocalPrefs.SetGamepadDisabled(false); } public void EnableMenu() diff --git a/Assets/Scripts/MenuScript.cs b/Assets/Scripts/MenuScript.cs index 262201a..bf62746 100644 --- a/Assets/Scripts/MenuScript.cs +++ b/Assets/Scripts/MenuScript.cs @@ -7,7 +7,7 @@ public class MenuScript : MonoBehaviour { Toggle? gamepadDisabledToggle; - void SetGamepadEnabled(bool value, Toggle gamepadDisabledToggle) + void SetGamepadDisabled(bool value, Toggle gamepadDisabledToggle) { gamepadDisabledToggle.isOn = value; @@ -30,17 +30,17 @@ void Awake() void Start() { - var gamepadEnabled = LocalPrefs.GetGamepadEnabled(); + var gamepadDisabled = LocalPrefs.GetGamepadDisabled(); if (gamepadDisabledToggle != null) { - SetGamepadEnabled(gamepadEnabled, gamepadDisabledToggle); + SetGamepadDisabled(gamepadDisabled, gamepadDisabledToggle); gamepadDisabledToggle.onValueChanged.AddListener((value) => { - SetGamepadEnabled(value, gamepadDisabledToggle); + SetGamepadDisabled(value, gamepadDisabledToggle); - LocalPrefs.SetGamepadEnabled(value); + LocalPrefs.SetGamepadDisabled(value); }); } } diff --git a/Assets/Scripts/PlayerScript.cs b/Assets/Scripts/PlayerScript.cs index c7b3180..25dd86e 100644 --- a/Assets/Scripts/PlayerScript.cs +++ b/Assets/Scripts/PlayerScript.cs @@ -152,7 +152,7 @@ void HandleConfigInitialization() { GameManagerScript.instance.DisableMenu(); - if (!LocalPrefs.GetGamepadEnabled()) + if (LocalPrefs.GetGamepadDisabled()) { GameManagerScript.instance.DisableGamepad(); } diff --git a/Assets/Scripts/Utils/LocalPrefs.cs b/Assets/Scripts/Utils/LocalPrefs.cs index ed944b9..38de452 100644 --- a/Assets/Scripts/Utils/LocalPrefs.cs +++ b/Assets/Scripts/Utils/LocalPrefs.cs @@ -9,18 +9,18 @@ public enum LocalPrefKeys public static class LocalPrefs { - public static bool GetGamepadEnabled() + public static bool GetGamepadDisabled() { return PlayerPrefs.GetInt( LocalPrefKeys.gamepadDisabled.ToString() - ) == 0; + ) == 1; } - public static void SetGamepadEnabled(bool gamepadEnabled) + public static void SetGamepadDisabled(bool gamepadDisabled) { PlayerPrefs.SetInt( LocalPrefKeys.gamepadDisabled.ToString(), - gamepadEnabled ? 0 : 1 + gamepadDisabled ? 1 : 0 ); } }