From a6c2841226c444676236437903c4241423f9fb03 Mon Sep 17 00:00:00 2001 From: Jakub Sztuba Date: Sat, 7 Jan 2023 12:02:47 +0100 Subject: [PATCH] Keybinding saving improvement --- Assembly-CSharp.csproj | 4 ++-- Assets/NewGame.cs | 24 +++++++++++++++++++++++- Assets/Scripts/KeyBindScript.cs | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Assembly-CSharp.csproj b/Assembly-CSharp.csproj index b4c3c1b7..48fc790b 100644 --- a/Assembly-CSharp.csproj +++ b/Assembly-CSharp.csproj @@ -133,6 +133,7 @@ + @@ -270,6 +271,7 @@ + @@ -323,8 +325,6 @@ - - diff --git a/Assets/NewGame.cs b/Assets/NewGame.cs index a02b5d9e..a3787f77 100644 --- a/Assets/NewGame.cs +++ b/Assets/NewGame.cs @@ -60,7 +60,29 @@ public class NewGame : MonoBehaviour PlayerPrefs.SetInt(SkillsPointsManger.PLAYER_SKILS_INTELIGENCE_POINTS, 0); // IntelligencePoints // -------------------------------------------------------------------- - + //DEFAULT CONTROLS + if (!PlayerPrefs.HasKey("Interact")) + { + PlayerPrefs.SetString("Interact","E"); + } + if (!PlayerPrefs.HasKey("Attack")) + { + PlayerPrefs.SetString("Attack","Space"); + } + if (!PlayerPrefs.HasKey("Skills")) + { + PlayerPrefs.SetString("Skills","U"); + } + if (!PlayerPrefs.HasKey("Inventory")) + { + PlayerPrefs.SetString("Inventory","I"); + } + if (!PlayerPrefs.HasKey("Settings")) + { + PlayerPrefs.SetString("Settings","Escape"); + } + // -------------------------------------------------------------------- + //LETTER -------------------------------------------------------------- PlayerPrefs.SetInt("PrologueLetter.WhereDisplayed", 0); PlayerPrefs.SetInt("ControlLetter.WhereDisplayed", 0); diff --git a/Assets/Scripts/KeyBindScript.cs b/Assets/Scripts/KeyBindScript.cs index ea8143d9..ea860122 100644 --- a/Assets/Scripts/KeyBindScript.cs +++ b/Assets/Scripts/KeyBindScript.cs @@ -37,7 +37,7 @@ public class KeyBindScript : MonoBehaviour keys.Add("Settings",(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Settings","Escape"))); keys.Add("Inventory",(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Inventory","I"))); keys.Add("Skills",(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Skills","U"))); - keys.Add("Attack",(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Attack","S6pace"))); + keys.Add("Attack",(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Attack","Space"))); //Sets the text on the buttons //interaction.text = keys["Interact"].ToString();