You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
4 years ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.EventSystems;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.InputSystem;
|
||
|
|
||
|
[RequireComponent(typeof(BaseGameObjInfo))]
|
||
|
public class TestScroll : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
// Use this for initialization
|
||
|
void Start () {
|
||
|
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
|
||
|
}
|
||
|
|
||
|
void OnEnable()
|
||
|
{
|
||
|
this.GetComponent<ScrollRect>().onValueChanged.AddListener(OnValueChanged);
|
||
|
}
|
||
|
|
||
|
void OnDisable()
|
||
|
{
|
||
|
this.GetComponent<ScrollRect>().onValueChanged.RemoveListener(OnValueChanged);
|
||
|
}
|
||
|
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
this.GetComponent<ScrollRect>().onValueChanged.RemoveListener(OnValueChanged);
|
||
|
}
|
||
|
|
||
|
public void OnValueChanged(Vector2 vctr)
|
||
|
{
|
||
|
var arg = new UIScrollCmdArgs();
|
||
|
arg.vctr = vctr;
|
||
|
|
||
|
ValueChanged(arg);
|
||
|
}
|
||
|
|
||
|
public void ValueChanged(CmdArgs arg)
|
||
|
{
|
||
|
if (GameSettings.othersSettings.playState==PlayState.Playing)
|
||
|
{
|
||
|
transform.Find("Scrollbar Vertical").GetComponent<Scrollbar>().value = ((UIScrollCmdArgs)arg).vctr.y;
|
||
|
}
|
||
|
|
||
|
RegisterUIInputEvent.RegisterUIInputHistory(gameObject, this.GetType().Name, "ValueChanged", arg);
|
||
|
|
||
|
Debug.Log("Scrolled!");
|
||
|
}
|
||
|
}
|