From 71be19ad98ff7017d92703f03b542e7c3a3743eb Mon Sep 17 00:00:00 2001 From: francois Date: Thu, 15 Mar 2018 23:33:26 +0100 Subject: [PATCH] Navigation highscore Modif input --- Assets/Scripts/HighscoresUiManager.cs | 11 +++-- Assets/Scripts/ScrollBarButtonScript.cs | 15 ++++-- ProjectSettings/InputManager.asset | 66 ++++++++++++++++++++++++- 3 files changed, 82 insertions(+), 10 deletions(-) diff --git a/Assets/Scripts/HighscoresUiManager.cs b/Assets/Scripts/HighscoresUiManager.cs index e8774e9..5b0ed88 100644 --- a/Assets/Scripts/HighscoresUiManager.cs +++ b/Assets/Scripts/HighscoresUiManager.cs @@ -12,7 +12,7 @@ public class HighscoresUiManager : BaseInputBehavior public List GridChildren = new List(); private string prefabPath = "Prefab/RankPanel"; public GameObject HighscoresPanel; - + public float scrollIncrement = 0.2f; void OnEnable() { @@ -60,18 +60,19 @@ public class HighscoresUiManager : BaseInputBehavior if (!string.IsNullOrEmpty(GameManager.Instance.YAxis)) { var verticalAxis = Input.GetAxis(GameManager.Instance.YAxis); + Debug.Log("Vertical" + verticalAxis); if (Math.Abs(verticalAxis) == 1) { var script = HighscoresPanel.GetComponent(); if (script != null) { - if (verticalAxis == 1) script.GoUp(); - else script.GoDown(); + if (verticalAxis == 1) script.GoUp(scrollIncrement); + else script.GoDown(scrollIncrement); } } } } - if(Input.GetKeyDown(GameManager.Instance.Submit) || Input.GetKeyDown(GameManager.Instance.Cancel)) - StartupScript.Current.Display(0, 2); + if (Input.GetButtonDown(GameManager.Instance.Submit) || Input.GetButtonDown(GameManager.Instance.Cancel)) + StartupScript.Current.Display(0, 2); } } diff --git a/Assets/Scripts/ScrollBarButtonScript.cs b/Assets/Scripts/ScrollBarButtonScript.cs index 932dcc8..6da2bce 100644 --- a/Assets/Scripts/ScrollBarButtonScript.cs +++ b/Assets/Scripts/ScrollBarButtonScript.cs @@ -7,7 +7,7 @@ public class ScrollBarButtonScript : MonoBehaviour { public Button DownButton; public Button UpButton; - public float step = 0.1f; + public const float step = 0.1f; public Scrollbar Scrollbar; // Use this for initialization @@ -24,14 +24,21 @@ public class ScrollBarButtonScript : MonoBehaviour public void GoDown() { - Scrollbar.value -=step; + GoDown(step); + } + public void GoDown(float increment) + { + Scrollbar.value -=increment; Debug.Log(Scrollbar.value); } public void GoUp() { - - Scrollbar.value+=step; + GoUp(step); + } + public void GoUp(float increment) + { + Scrollbar.value+=increment; Debug.Log(Scrollbar.value); } diff --git a/ProjectSettings/InputManager.asset b/ProjectSettings/InputManager.asset index 33d7597..708b661 100644 --- a/ProjectSettings/InputManager.asset +++ b/ProjectSettings/InputManager.asset @@ -60,7 +60,7 @@ InputManager: negativeButton: positiveButton: joystick button 1 altNegativeButton: - altPositiveButton: escape + altPositiveButton: right ctrl gravity: 1000 dead: 0.001 sensitivity: 1000 @@ -277,3 +277,67 @@ InputManager: type: 0 axis: 1 joyNum: 0 + - serializedVersion: 3 + m_Name: Submit + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: space + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Cancel + descriptiveName: + descriptiveNegativeName: + negativeButton: + positiveButton: left ctrl + altNegativeButton: + altPositiveButton: + gravity: 1000 + dead: 0.001 + sensitivity: 1000 + snap: 0 + invert: 0 + type: 0 + axis: 1 + joyNum: 0 + - serializedVersion: 3 + m_Name: Horizontal + descriptiveName: General horizontal for all joystick + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 2 + axis: 0 + joyNum: 0 + - serializedVersion: 3 + m_Name: Vertical + descriptiveName: General vertical for all joystick + descriptiveNegativeName: + negativeButton: + positiveButton: + altNegativeButton: + altPositiveButton: + gravity: 3 + dead: 0.001 + sensitivity: 3 + snap: 1 + invert: 0 + type: 2 + axis: 1 + joyNum: 0