Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        scrollView = NGUITools.FindInParents <AngleScrollView>(gameObject);
        panel      = transform.GetComponent <UIPanel>();

        MAXDISTANCE = scrollView.panel.width / 2;
    }
Esempio n. 2
0
 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();
     }
 }
Esempio n. 3
0
    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;
    }
Esempio n. 4
0
    /// <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;
    }
Esempio n. 5
0
    /// <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();
        }
    }
Esempio n. 6
0
 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;
         }
     }
 }
Esempio n. 7
0
    /// <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;
            }
        }
    }
Esempio n. 8
0
 private void Start()
 {
     this.scrollView  = NGUITools.FindInParents <AngleScrollView>(base.gameObject);
     this.panel       = base.transform.GetComponent <UIPanel>();
     this.MAXDISTANCE = this.scrollView.panel.width / 2f;
 }