Changing of controls Attack and Settings progress

This commit is contained in:
Jakub Sztuba 2023-01-07 02:56:38 +01:00
parent 54c4d1728c
commit ec1368d90a
6 changed files with 33 additions and 10 deletions

View File

@ -324,6 +324,7 @@
<Compile Include="Assets\Scripts\REFACTORING\Application\UI\Panel\TaskPanelController.cs" /> <Compile Include="Assets\Scripts\REFACTORING\Application\UI\Panel\TaskPanelController.cs" />
<Compile Include="Assets\Scripts\Player.cs" /> <Compile Include="Assets\Scripts\Player.cs" />
<Compile Include="Assets\ContinueButton.cs" /> <Compile Include="Assets\ContinueButton.cs" />
<Compile Include="Assets\Scripts\REFACTORING\Story\WizardHouse\WizardFirstQuestManager.cs" />
<None Include="Assets\TextMesh Pro\Shaders\TMPro.cginc" /> <None Include="Assets\TextMesh Pro\Shaders\TMPro.cginc" />
<None Include="Assets\HardLight2D\ReadMe - FAQ.txt" /> <None Include="Assets\HardLight2D\ReadMe - FAQ.txt" />
<None Include="Assets\TextMesh Pro\Shaders\TMP_SDF-Mobile Overlay.shader" /> <None Include="Assets\TextMesh Pro\Shaders\TMP_SDF-Mobile Overlay.shader" />

View File

@ -13,7 +13,8 @@ public class OpenSettingsOnESCPress : MonoBehaviour
void Update() void Update()
{ {
if (Input.GetKeyUp(KeyCode.Escape)) KeyCode keyToSettings = (KeyCode) System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Settings"));
if (Input.GetKeyUp(keyToSettings))
{ {
if ((SettingsMainPanel.active == false) && (SettingsPanel.active == false) && (SoundsPanel.active == false) && (ControlsPanel.active == false) && (LanguagePanel.active == false)) if ((SettingsMainPanel.active == false) && (SettingsPanel.active == false) && (SoundsPanel.active == false) && (ControlsPanel.active == false) && (LanguagePanel.active == false))
{ {

View File

@ -63601,6 +63601,18 @@ MonoBehaviour:
m_StringArgument: m_StringArgument:
m_BoolArgument: 0 m_BoolArgument: 0
m_CallState: 2 m_CallState: 2
- m_Target: {fileID: 1554558665}
m_TargetAssemblyTypeName: KeyBindScript, Assembly-CSharp
m_MethodName: SaveKeys
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &838488728 --- !u!114 &838488728
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -37,14 +37,20 @@ public class KeyBindScript : MonoBehaviour
keys.Add("Settings",(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Settings","Escape"))); 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("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("Skills",(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Skills","U")));
keys.Add("Attack",(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Attack","Space"))); keys.Add("Attack",(KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Attack","S6pace")));
//Sets the text on the buttons //Sets the text on the buttons
interaction.text = keys["Interact"].ToString(); //interaction.text = keys["Interact"].ToString();
skills.text = keys["Settings"].ToString(); interaction.text = PlayerPrefs.GetString("Interact");
settings.text = keys["Inventory"].ToString(); //skills.text = keys["Settings"].ToString();
attack.text = keys["Skills"].ToString(); skills.text = PlayerPrefs.GetString("Skills");
inventory.text = keys["Attack"].ToString(); //settings.text = keys["Inventory"].ToString();
settings.text = PlayerPrefs.GetString("Settings");
//attack.text = keys["Skills"].ToString();
attack.text = PlayerPrefs.GetString("Attack");
//inventory.text = keys["Attack"].ToString();
inventory.text = PlayerPrefs.GetString("Inventory");
} }
@ -124,8 +130,10 @@ public class KeyBindScript : MonoBehaviour
{ {
PlayerPrefs.SetString(key.Key, key.Value.ToString()); //Saves the keybinds for each key PlayerPrefs.SetString(key.Key, key.Value.ToString()); //Saves the keybinds for each key
} }
PlayerPrefs.Save(); PlayerPrefs.Save();
InventoryUIManager.Instance.keyToOpen = (KeyCode) System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Inventory"));
EquipmentUIManager.Instance.keyToOpen = (KeyCode) System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Inventory"));
SkillsUIManager.Instance.keyToOpen = (KeyCode) System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Skills"));
} }
} }

View File

@ -229,7 +229,9 @@ public class Player : MonoBehaviour
private void HandleInput() private void HandleInput()
{ {
if (Input.GetKeyDown(KeyCode.Space)) KeyCode keyToAttack = (KeyCode) System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Attack"));
if (Input.GetKeyDown(keyToAttack))
{ {
attackSword = true; attackSword = true;
} }

View File

@ -32,7 +32,6 @@ public class ChestUIManager : UIBaseManager<Chest>
} }
} }
public override void Update() public override void Update()
{ {
base.Update(); base.Update();