Ejemplo n.º 1
0
        /// <inheritdoc/>
        protected override void Awake()
        {
            // Make room at the start (top or left) for the header. It's important to set this before the adapter is initialized,
            // because it caches the padding value during that time and only re-reads it from params when major events happen, like a resizing of the ScrollView
            var ctPad    = _Params.ContentPadding;
            int padToSet = (int)(_Params.Table.ColumnsTupleSize + _Params.Table.ColumnsTupleSpacing + .5f);

            if (IsHorizontal)
            {
                ctPad.left = padToSet;
            }
            else
            {
                ctPad.top = padToSet;
            }

            _Header = CreateHeaderViewsHolder();
            if (_Params.Table.ColumnsScrollbar)
            {
                _Header.Adapter.TupleParameters.Scrollbar = _Params.Table.ColumnsScrollbar;
                _ScrollbarFixerColumns = OSAUtil.ConfigureDinamicallyCreatedScrollbar(
                    _Params.Table.ColumnsScrollbar,
                    _Header.Adapter,
                    _Header.Adapter.TupleParameters.Viewport,
                    false
                    );
            }

            if (_Params.Scrollbar)
            {
                _ScrollbarFixerTuples = _Params.Scrollbar.GetComponent <ScrollbarFixer8>();
            }

            base.Awake();
        }
Ejemplo n.º 2
0
        void Start()
        {
            //if (maxNeighborsToSnapToRegardlessOfSpeed < 0)
            //	maxNeighborsToSnapToRegardlessOfSpeed = 0;
            if (minSpeedToAllowSnapToNext < 0)
            {
                minSpeedToAllowSnapToNext = float.MaxValue;
            }
            _SnapToNextOnlyEnabled = minSpeedToAllowSnapToNext != float.MaxValue;

            if (scrollbar)
            {
                _ScrollbarFixer = scrollbar.GetComponent <ScrollbarFixer8>();
                if (!_ScrollbarFixer)
                {
                    throw new UnityException("ScrollbarFixer8 should be attached to Scrollbar");
                }
            }

            if (scrollbar)
            {
                scrollbar.onValueChanged.AddListener(OnScrollbarValueChanged);
            }
            _StartCalled = true;
        }
Ejemplo n.º 3
0
        void Start()
        {
            //if (maxNeighborsToSnapToRegardlessOfSpeed < 0)
            //	maxNeighborsToSnapToRegardlessOfSpeed = 0;
            if (minSpeedToAllowSnapToNext < 0)
            {
                minSpeedToAllowSnapToNext = float.MaxValue;
            }
            _SnapToNextOnlyEnabled = minSpeedToAllowSnapToNext != float.MaxValue;

            if (scrollbar)
            {
                _ScrollbarFixer = scrollbar.GetComponent <ScrollbarFixer8>();
                if (!_ScrollbarFixer)
                {
                    throw new UnityException("ScrollbarFixer8 should be attached to Scrollbar");
                }
            }

            _ScrollRect = GetComponent <ScrollRect>();
            //_ScrollRect.onValueChanged.AddListener(OnScrolled);

            // _ScrollRect.velocity doesn't reflect <curNormPos-prevNormPos>, as it would be expected, but the opposite of that (opposite sign)
            // Returning: negative, if towards end; positive, else.
            if (_ScrollRect.horizontal)
            {
                _GetSignedAbstractSpeed = () => _ScrollRect.velocity[0];
            }
            else
            {
                _GetSignedAbstractSpeed = () => - _ScrollRect.velocity[1];
            }

            if (scrollbar)
            {
                scrollbar.onValueChanged.AddListener(OnScrollbarValueChanged);
            }
            _StartCalled = true;
        }