private void LateUpdate()
 {
     if (spring == null)
     {
         spring = base.GetComponent <SpringPanel>((Enum)UI.SCR_ABILITY);
     }
     if (spring != null && spring.get_enabled())
     {
         int i = 0;
         for (int num = spr.Length; i < num; i++)
         {
             UISprite component = base.GetComponent <UISprite>((Enum)spr[i]);
             component.UpdateAnchors();
         }
     }
 }
コード例 #2
0
    private void LateUpdate()
    {
        if (!Application.get_isPlaying())
        {
            return;
        }
        float deltaTime = RealTime.deltaTime;

        if (this.showScrollBars != UIScrollView.ShowCondition.Always && (this.verticalScrollBar || this.horizontalScrollBar))
        {
            bool flag  = false;
            bool flag2 = false;
            if (this.showScrollBars != UIScrollView.ShowCondition.WhenDragging || this.mDragID != -10 || this.mMomentum.get_magnitude() > 0.01f)
            {
                flag  = this.shouldMoveVertically;
                flag2 = this.shouldMoveHorizontally;
            }
            if (this.verticalScrollBar)
            {
                float num = this.verticalScrollBar.alpha;
                num += ((!flag) ? (-deltaTime * 3f) : (deltaTime * 6f));
                num  = Mathf.Clamp01(num);
                if (this.verticalScrollBar.alpha != num)
                {
                    this.verticalScrollBar.alpha = num;
                }
            }
            if (this.horizontalScrollBar)
            {
                float num2 = this.horizontalScrollBar.alpha;
                num2 += ((!flag2) ? (-deltaTime * 3f) : (deltaTime * 6f));
                num2  = Mathf.Clamp01(num2);
                if (this.horizontalScrollBar.alpha != num2)
                {
                    this.horizontalScrollBar.alpha = num2;
                }
            }
        }
        if (!this.mShouldMove)
        {
            return;
        }
        if (!this.mPressed)
        {
            if (this.mMomentum.get_magnitude() > 0.0001f || this.mScroll != 0f)
            {
                if (this.movement == UIScrollView.Movement.Horizontal)
                {
                    this.mMomentum -= this.mTrans.TransformDirection(new Vector3(this.mScroll * 0.05f, 0f, 0f));
                }
                else if (this.movement == UIScrollView.Movement.Vertical)
                {
                    this.mMomentum -= this.mTrans.TransformDirection(new Vector3(0f, this.mScroll * 0.05f, 0f));
                }
                else if (this.movement == UIScrollView.Movement.Unrestricted)
                {
                    this.mMomentum -= this.mTrans.TransformDirection(new Vector3(this.mScroll * 0.05f, this.mScroll * 0.05f, 0f));
                }
                else
                {
                    this.mMomentum -= this.mTrans.TransformDirection(new Vector3(this.mScroll * this.customMovement.x * 0.05f, this.mScroll * this.customMovement.y * 0.05f, 0f));
                }
                this.mScroll = NGUIMath.SpringLerp(this.mScroll, 0f, 20f, deltaTime);
                Vector3 absolute = NGUIMath.SpringDampen(ref this.mMomentum, this.dampenStrength, deltaTime);
                this.MoveAbsolute(absolute);
                if (this.restrictWithinPanel && this.mPanel.clipping != UIDrawCall.Clipping.None)
                {
                    if (NGUITools.GetActive(this.centerOnChild))
                    {
                        if (this.centerOnChild.nextPageThreshold != 0f)
                        {
                            this.mMomentum = Vector3.get_zero();
                            this.mScroll   = 0f;
                        }
                        else
                        {
                            this.centerOnChild.Recenter();
                        }
                    }
                    else
                    {
                        this.RestrictWithinBounds(false, this.canMoveHorizontally, this.canMoveVertically);
                    }
                }
                if (this.onMomentumMove != null)
                {
                    this.onMomentumMove();
                }
            }
            else
            {
                this.mScroll   = 0f;
                this.mMomentum = Vector3.get_zero();
                SpringPanel component = base.GetComponent <SpringPanel>();
                if (component != null && component.get_enabled())
                {
                    return;
                }
                this.mShouldMove = false;
                if (this.onStoppedMoving != null)
                {
                    this.onStoppedMoving();
                }
            }
        }
        else
        {
            this.mScroll = 0f;
            NGUIMath.SpringDampen(ref this.mMomentum, 9f, deltaTime);
        }
    }