コード例 #1
0
        protected override void OnTopDataIndexChanged(int newIndex)
        {
            try {
                base.OnTopDataIndexChanged(newIndex);

                for (int i = 0; i < rowCount; ++i)
                {
                    if (topDataIndex + i < dataCount)
                    {
                        for (int k = 0; k < data[topDataIndex + i].Count; ++k)
                        {
                            GameDataCell dataCell = dataRows[i][k];
                            dataCell.Initialize(data[topDataIndex + i][k]);
                            if (!dataCell.gameObject.activeSelf)
                            {
                                dataCell.gameObject.SetActive(true);
                            }
                        }
                    }
                    else
                    {
                        foreach (GameObject dataCell in rowObjects[i])
                        {
                            dataCell.SetActive(false);
                        }
                    }
                }
            }
            catch (Exception e) {
                Debug.LogException(e);
            }
        }
コード例 #2
0
        //Cell data output happens here, when a  row is added
        protected override void OnRowAdded(List <GameObject> row, int rowIndex)
        {
            base.OnRowAdded(row, rowIndex);

            List <GameDataCell> dataRow = new List <GameDataCell>();

            for (int i = 0; i < row.Count; ++i)
            {
                GameDataCell cell = row[i].GetComponent <GameDataCell>();
                dataRow.Add(cell);

                //Fill row with data if we have data for this data index
                if (topDataIndex + rowIndex < dataCount)
                {
                    cell.Initialize(data[topDataIndex + rowIndex][i]);
                    if (!cell.gameObject.activeSelf)
                    {
                        cell.gameObject.SetActive(true);
                    }
                }
                else
                {
                    cell.gameObject.SetActive(false);
                }
            }

            dataRows.Add(dataRow);
        }