Navigation highscore

Modif input
This commit is contained in:
francois 2018-03-15 23:33:26 +01:00
parent a9ad9598b0
commit 71be19ad98
3 changed files with 82 additions and 10 deletions

View File

@ -12,7 +12,7 @@ public class HighscoresUiManager : BaseInputBehavior
public List<GameObject> GridChildren = new List<GameObject>();
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<ScrollBarButtonScript>();
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);
}
}

View File

@ -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);
}

View File

@ -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