ParallelRoadTool/UI/UIFastList.cs
/// <summary>
///     Display the data at the position in the top row.
///     This update the list even if the position remind the same
/// </summary>
/// <param name="pos">Index position in the list</param>
Display the data at the position in the top row.
This update the list even if the position remind the same
Display the data at the position in the top row . This update the list even if the position remind the same
public void DisplayAt(float pos)
        {
            if (_rowsData == null || _rowHeight <= 0) return;
            SetupControls();
            _pos = Mathf.Max(Mathf.Min(pos, _rowsData.m_size - height / _rowHeight), 0f);
            for (var i = 0; i < _rows.m_size; i++)
            {
                var dataPos = Mathf.FloorToInt(_pos + i);
                var offset = rowHeight * (_pos + i - dataPos);
                if (dataPos < _rowsData.m_size)
                {
                    if (_updateContent)
                        _rows[i].Display(_rowsData[dataPos], dataPos);
                    if (dataPos == _selectedDataId && _updateContent)
                    {
                        _selectedRowId = i;
                        _rows[_selectedRowId].Select(dataPos % 2 == 1);
                    }
                    _rows[i].enabled = true;
                }
                else
                {
                    _rows[i].enabled = false;
                }
                _rows[i].relativePosition = new Vector3(0, i * rowHeight - offset);
            }
            UpdateScrollbar();
            _updateContent = true;
        }
public void DisplayAt ( float pos ) { if ( _rowsData == null || _rowHeight <= 0 ) return ; SetupControls ( ) ; _pos = Mathf . Max ( Mathf . Min ( pos , _rowsData . m_size - height / _rowHeight ) , 0f ) ; for ( var i = 0 ; i < _rows . m_size ; i ++ ) { var dataPos = Mathf . FloorToInt ( _pos + i ) ; var offset = rowHeight * ( _pos + i - dataPos ) ; if ( dataPos < _rowsData . m_size ) { if ( _updateContent ) _rows [ i ] . Display ( _rowsData [ dataPos ] , dataPos ) ; if ( dataPos == _selectedDataId && _updateContent ) { _selectedRowId = i ; _rows [ _selectedRowId ] . Select ( dataPos % 2 == 1 ) ; } _rows [ i ] . enabled = true ; } else { _rows [ i ] . enabled = false ; } _rows [ i ] . relativePosition = new Vector3 ( 0 , i * rowHeight - offset ) ; } UpdateScrollbar ( ) ; _updateContent = true ; }
Display the data at the position in the top row.
Display the data at the position in the top row .
pos
float
Index position in the list
Index position in the list