Exemple #1
0
 public void SetDirtyLayout()
 {
     RefreshLayoutTimer.Restart();
 }
Exemple #2
0
        void FixedUpdate()
        {
            if (updateSpacing)
            {
                UpdateSpacing(spacing);
            }

            //更新滑杆速度,防止速度不稳定,增加手感
            if (ScrollRect != null)
            {
                if (ScrollRectSize > cellOffsetArray.Last())
                {
                    ScrollRect.scrollSensitivity = 2;
                }
                else
                {
                    ScrollRect.scrollSensitivity = 15;
                }
            }

            // if the scroll rect size has changed and looping is on,
            // or the loop setting has changed, then we need to resize
            if (
                (loop && lastScrollRectSize != ScrollRectSize) ||
                (loop != lastLoop)
                )
            {
                Resize(true);
                lastScrollRectSize = ScrollRectSize;

                lastLoop = loop;
            }

            // update the scroll bar visibility if it has changed
            if (lastScrollbarVisibility != scrollbarVisibility)
            {
                ScrollbarVisibility     = scrollbarVisibility;
                lastScrollbarVisibility = scrollbarVisibility;
            }

            // determine if the scroller has started or stopped scrolling
            // and call the delegate if so.
            if (LinearVelocity != 0 && !IsScrolling)
            {
                IsScrolling = true;
                Callback_ScrollerScrollingChanged?.Invoke(this, true);
            }
            else if (LinearVelocity == 0 && IsScrolling)
            {
                IsScrolling = false;
                Callback_ScrollerScrollingChanged?.Invoke(this, false);
            }

            if (Scrollbar && IsFixedScrollBar)
            {
                Scrollbar.size = ScrollBarSize;
            }

            if (Content != null && RefreshLayoutTimer.CheckOverOnce())
            {
                //刷新布局
                LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
            }

            if (BaseInputMgr.IsScrollWheel)
            {
                if (ScrollRect)
                {
                    ScrollRect.velocity = Vector2.zero;
                }
            }
            if (ScrollRect && BaseGuideView.Default)
            {
                ScrollRect.enabled = !BaseGuideView.Default.IsInMask; //!IsBlockClick();
            }
        }