This commit is contained in:
Your Name 2018-03-15 23:34:20 +01:00
commit 8d610ecacc
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>(); public List<GameObject> GridChildren = new List<GameObject>();
private string prefabPath = "Prefab/RankPanel"; private string prefabPath = "Prefab/RankPanel";
public GameObject HighscoresPanel; public GameObject HighscoresPanel;
public float scrollIncrement = 0.2f;
void OnEnable() void OnEnable()
{ {
@ -60,18 +60,19 @@ public class HighscoresUiManager : BaseInputBehavior
if (!string.IsNullOrEmpty(GameManager.Instance.YAxis)) if (!string.IsNullOrEmpty(GameManager.Instance.YAxis))
{ {
var verticalAxis = Input.GetAxis(GameManager.Instance.YAxis); var verticalAxis = Input.GetAxis(GameManager.Instance.YAxis);
Debug.Log("Vertical" + verticalAxis);
if (Math.Abs(verticalAxis) == 1) if (Math.Abs(verticalAxis) == 1)
{ {
var script = HighscoresPanel.GetComponent<ScrollBarButtonScript>(); var script = HighscoresPanel.GetComponent<ScrollBarButtonScript>();
if (script != null) if (script != null)
{ {
if (verticalAxis == 1) script.GoUp(); if (verticalAxis == 1) script.GoUp(scrollIncrement);
else script.GoDown(); else script.GoDown(scrollIncrement);
} }
} }
} }
} }
if(Input.GetKeyDown(GameManager.Instance.Submit) || Input.GetKeyDown(GameManager.Instance.Cancel)) if (Input.GetButtonDown(GameManager.Instance.Submit) || Input.GetButtonDown(GameManager.Instance.Cancel))
StartupScript.Current.Display(0, 2); StartupScript.Current.Display(0, 2);
} }
} }

View File

@ -7,7 +7,7 @@ public class ScrollBarButtonScript : MonoBehaviour
{ {
public Button DownButton; public Button DownButton;
public Button UpButton; public Button UpButton;
public float step = 0.1f; public const float step = 0.1f;
public Scrollbar Scrollbar; public Scrollbar Scrollbar;
// Use this for initialization // Use this for initialization
@ -24,14 +24,21 @@ public class ScrollBarButtonScript : MonoBehaviour
public void GoDown() public void GoDown()
{ {
Scrollbar.value -=step; GoDown(step);
}
public void GoDown(float increment)
{
Scrollbar.value -=increment;
Debug.Log(Scrollbar.value); Debug.Log(Scrollbar.value);
} }
public void GoUp() public void GoUp()
{ {
GoUp(step);
Scrollbar.value+=step; }
public void GoUp(float increment)
{
Scrollbar.value+=increment;
Debug.Log(Scrollbar.value); Debug.Log(Scrollbar.value);
} }

View File

@ -60,7 +60,7 @@ InputManager:
negativeButton: negativeButton:
positiveButton: joystick button 1 positiveButton: joystick button 1
altNegativeButton: altNegativeButton:
altPositiveButton: escape altPositiveButton: right ctrl
gravity: 1000 gravity: 1000
dead: 0.001 dead: 0.001
sensitivity: 1000 sensitivity: 1000
@ -277,3 +277,67 @@ InputManager:
type: 0 type: 0
axis: 1 axis: 1
joyNum: 0 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