using System.Collections; using System.Collections.Generic; using UnityEngine; using XLua; using Coolape; [RequireComponent (typeof(UIScrollView))] public class KKUIScrollView : MonoBehaviour { public CLBaseLua lua; public UICenterOnChild centerOnChild; UIScrollView _scrollView; public UIScrollView scrollView { get { if (_scrollView == null) _scrollView = GetComponent (); return _scrollView; } } public void onDragStarted () { Utl.doCallback (lua.getLuaFunction ("onDragStarted"), scrollView); } public void onDragmMove () { Utl.doCallback (lua.getLuaFunction ("onDragmMove"), scrollView); } public void onMomentumMove () { Utl.doCallback (lua.getLuaFunction ("onMomentumMove"), scrollView); } public void onDragFinished () { Utl.doCallback (lua.getLuaFunction ("onDragFinished"), scrollView); } public void onStoppedMoving () { Utl.doCallback (lua.getLuaFunction ("onStoppedMoving"), scrollView); } public void onStartCenterOnChild () { Utl.doCallback (lua.getLuaFunction ("onStartCenterOnChild"), scrollView); } public void onCenterChild (GameObject center) { Utl.doCallback (lua.getLuaFunction ("onCenterChild"), center, scrollView); } public void onFinishCenterChild () { Utl.doCallback (lua.getLuaFunction ("onFinishCenterChild"), scrollView); } public void Start () { scrollView.onDragStarted = (UIScrollView.OnDragNotification)onDragStarted; scrollView.onMomentumMove = (UIScrollView.OnDragNotification)onMomentumMove; scrollView.onDragFinished = (UIScrollView.OnDragNotification)onDragFinished; scrollView.onStoppedMoving = (UIScrollView.OnDragNotification)onStoppedMoving; scrollView.onDragmMove = (UIScrollView.OnDragNotification)onDragmMove; scrollView.onStartCenterOnChild = (UIScrollView.OnDragNotification)onStartCenterOnChild; if (centerOnChild != null) { centerOnChild.onFinished = (SpringPanel.OnFinished)onFinishCenterChild; centerOnChild.onCenter = (UICenterOnChild.OnCenterCallback)onCenterChild; } } }