// Use this for initialization void Start() { scrollView = NGUITools.FindInParents <AngleScrollView>(gameObject); panel = transform.GetComponent <UIPanel>(); MAXDISTANCE = scrollView.panel.width / 2; }
private void OnEnable() { this.mTrans = base.transform; if (this.scrollView == null && this.draggablePanel != null) { this.scrollView = this.draggablePanel; this.draggablePanel = null; } if (this.mAutoFind || this.mScroll == null) { this.FindScrollView(); } }
private void FindScrollView() { AngleScrollView y = NGUITools.FindInParents <AngleScrollView>(this.mTrans); if (this.scrollView == null) { this.scrollView = y; this.mAutoFind = true; } else if (this.scrollView == y) { this.mAutoFind = true; } this.mScroll = this.scrollView; }
/// <summary> /// Find the scroll view to work with. /// </summary> void FindScrollView() { // If the scroll view is on a parent, don't try to remember it (as we want it to be dynamic in case of re-parenting) AngleScrollView sv = NGUITools.FindInParents <AngleScrollView>(mTrans); if (scrollView == null) { scrollView = sv; mAutoFind = true; } else if (scrollView == sv) { mAutoFind = true; } mScroll = scrollView; }
/// <summary> /// Automatically find the scroll view if possible. /// </summary> void OnEnable() { mTrans = transform; // Auto-upgrade if (scrollView == null && draggablePanel != null) { scrollView = draggablePanel; draggablePanel = null; } if (mAutoFind || mScroll == null) { FindScrollView(); } }
private void OnPress(bool pressed) { if (this.mAutoFind && this.mScroll != this.scrollView) { this.mScroll = this.scrollView; this.mAutoFind = false; } if (this.scrollView && base.enabled && NGUITools.GetActive(base.gameObject)) { this.scrollView.Press(pressed); if (!pressed && this.mAutoFind) { this.scrollView = NGUITools.FindInParents <AngleScrollView>(this.mTrans); this.mScroll = this.scrollView; } } }
/// <summary> /// Create a plane on which we will be performing the dragging. /// </summary> void OnPress(bool pressed) { // If the scroll view has been set manually, don't try to find it again if (mAutoFind && mScroll != scrollView) { mScroll = scrollView; mAutoFind = false; } if (scrollView && enabled && NGUITools.GetActive(gameObject)) { scrollView.Press(pressed); if (!pressed && mAutoFind) { scrollView = NGUITools.FindInParents <AngleScrollView>(mTrans); mScroll = scrollView; } } }
private void Start() { this.scrollView = NGUITools.FindInParents <AngleScrollView>(base.gameObject); this.panel = base.transform.GetComponent <UIPanel>(); this.MAXDISTANCE = this.scrollView.panel.width / 2f; }