示例#1
0
    public void ScrollToPosition(float pos)
    {
        if (IsInited)
        {
            _ScrollRect.StopMovement();
            Vector2 v = _Content.anchoredPosition;
            v.y = GNewUITools.ClampScrollPos(pos, _Content, _ScrollRect);

            _Content.anchoredPosition = v;
        }
    }
示例#2
0
    //flat means unsigned
    public void ScrollToPosition(float flatPos)
    {
        SafeInit();

        if (_ScrollRect != null)
        {
            _ScrollRect.StopMovement();
            Vector2 v = RectTrans.anchoredPosition;
            if (IsVertical)
            {
                //v.y = ClampScrollPos(flatPos) * DirSign;
                v.y = GNewUITools.ClampScrollPos(flatPos, RectTrans, _ScrollRect) * DirSign;
            }
            else
            {
                //v.x = ClampScrollPos(flatPos) * DirSign;
                v.x = GNewUITools.ClampScrollPos(flatPos, RectTrans, _ScrollRect) * DirSign;
            }

            RectTrans.anchoredPosition = v;
        }
    }