using System; using UnityEngine; public class ScrollViewScroll : MonoBehaviour { private void OnPress(bool pressed) { this.m_bPress = pressed; } public void OnEnable() { this.m_bPress = false; } public void OnDisable() { this.m_bPress = false; } private void Update() { if (this.m_bPress && 0f <= this.m_ScrollBar.value && this.m_ScrollBar.value <= 1f) { if (this.scrollView != null) { this.scrollView.Scroll(this.delta * Time.deltaTime); } else { this.m_ScrollBar.value += this.delta * Time.deltaTime; } } if (this.m_bAlphatSync && this.m_ScrollBar != null && this.m_Sprite != null) { this.m_Sprite.alpha = this.m_ScrollBar.alpha; } } public UIScrollView scrollView; public float delta; public UIProgressBar m_ScrollBar; public UIWidget m_Sprite; public bool m_bAlphatSync = true; private bool m_bPress; }