Example #1
0
        /// <summary>
        /// Notify the table view that one of its rows changed size
        /// </summary>
        public void NotifyCellDimensionsChanged(int row)
        {
            float oldHeight = m_rowHeights[row];

            m_rowHeights[row] = m_dataSource.GetHeightForRowInTableView(this, row);
            if (row > 0)
            {
                m_rowHeights[row] += m_verticalLayoutGroup.spacing;
            }
            m_cleanCumulativeIndex = Mathf.Min(m_cleanCumulativeIndex, row - 1);
            TableViewCell cell = GetCellAtRow(row);

            if (cell != null)
            {
                cell.GetComponent <LayoutElement>().preferredHeight = m_rowHeights[row];
                if (row > 0)
                {
                    cell.GetComponent <LayoutElement>().preferredHeight -= m_verticalLayoutGroup.spacing;
                }
            }
            float heightDelta = m_rowHeights[row] - oldHeight;

            m_scrollRect.content.sizeDelta = new Vector2(m_scrollRect.content.sizeDelta.x,
                                                         m_scrollRect.content.sizeDelta.y + heightDelta);
            m_requiresRefresh = true;
        }
Example #2
0
        private void AddRow(int row, bool atEnd)
        {
            TableViewCell newCell = m_dataSource.GetCellForRowInTableView(this, row);

            newCell.transform.SetParent(m_scrollRect.content, false);

            LayoutElement layoutElement = newCell.GetComponent <LayoutElement>();

            if (layoutElement == null)
            {
                layoutElement = newCell.gameObject.AddComponent <LayoutElement>();
            }
            layoutElement.preferredHeight = m_rowHeights[row];
            if (row > 0)
            {
                layoutElement.preferredHeight -= m_verticalLayoutGroup.spacing;
            }

            m_visibleCells[row] = newCell;
            if (atEnd)
            {
                newCell.transform.SetSiblingIndex(m_scrollRect.content.childCount - 2); //One before bottom padding
            }
            else
            {
                newCell.transform.SetSiblingIndex(1); //One after the top padding
            }
            this.onCellVisibilityChanged.Invoke(row, true);
        }
Example #3
0
        // Token: 0x0600451F RID: 17695 RVA: 0x0017195C File Offset: 0x0016FD5C
        private void AddRow(int row, bool atEnd)
        {
            TableViewCell cellForRowInTableView = this.m_dataSource.GetCellForRowInTableView(this, row);

            cellForRowInTableView.transform.SetParent(this.m_scrollRect.content, false);
            LayoutElement layoutElement = cellForRowInTableView.GetComponent <LayoutElement>();

            if (layoutElement == null)
            {
                layoutElement = cellForRowInTableView.gameObject.AddComponent <LayoutElement>();
            }
            layoutElement.preferredHeight = this.m_rowHeights[row];
            if (row > 0)
            {
                layoutElement.preferredHeight -= this.m_verticalLayoutGroup.spacing;
            }
            this.m_visibleCells[row] = cellForRowInTableView;
            if (atEnd)
            {
                cellForRowInTableView.transform.SetSiblingIndex(this.m_scrollRect.content.childCount - 2);
            }
            else
            {
                cellForRowInTableView.transform.SetSiblingIndex(1);
            }
            this.onCellVisibilityChanged.Invoke(row, true);
        }
Example #4
0
        // Token: 0x0600450F RID: 17679 RVA: 0x00171524 File Offset: 0x0016F924
        public void NotifyCellDimensionsChanged(int row)
        {
            float num = this.m_rowHeights[row];

            this.m_rowHeights[row]      = this.m_dataSource.GetHeightForRowInTableView(this, row);
            this.m_cleanCumulativeIndex = Mathf.Min(this.m_cleanCumulativeIndex, row - 1);
            if (this.m_visibleRowRange.Contains(row))
            {
                TableViewCell cellAtRow = this.GetCellAtRow(row);
                cellAtRow.GetComponent <LayoutElement>().preferredHeight = this.m_rowHeights[row];
                if (row > 0)
                {
                    cellAtRow.GetComponent <LayoutElement>().preferredHeight -= this.m_verticalLayoutGroup.spacing;
                }
            }
            float num2 = this.m_rowHeights[row] - num;

            this.m_scrollRect.content.sizeDelta = new Vector2(this.m_scrollRect.content.sizeDelta.x, this.m_scrollRect.content.sizeDelta.y + num2);
            this.m_requiresRefresh = true;
        }