50 lines
944 B
C#
50 lines
944 B
C#
using UnityEngine;
|
|
using System.Collections;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.EventSystems;
|
|
|
|
public class ScrollBarButtonScript : MonoBehaviour
|
|
{
|
|
public Button DownButton;
|
|
public Button UpButton;
|
|
public const float step = 0.1f;
|
|
|
|
public Scrollbar Scrollbar;
|
|
// Use this for initialization
|
|
void Start()
|
|
{
|
|
DownButton.onClick.AddListener(GoDown);
|
|
UpButton.onClick.AddListener(GoUp);
|
|
}
|
|
|
|
private void OnEnable()
|
|
{
|
|
Scrollbar.value = 0;
|
|
}
|
|
|
|
public void GoDown()
|
|
{
|
|
GoDown(step);
|
|
}
|
|
public void GoDown(float increment)
|
|
{
|
|
Scrollbar.value -=increment;
|
|
Debug.Log(Scrollbar.value);
|
|
}
|
|
|
|
public void GoUp()
|
|
{
|
|
GoUp(step);
|
|
}
|
|
public void GoUp(float increment)
|
|
{
|
|
Scrollbar.value+=increment;
|
|
Debug.Log(Scrollbar.value);
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
}
|
|
}
|