//Will be called by the TableView when a cell needs to be created for display public TableViewCell GetCellForRowInTableView(TableView tableView, int row) { DetailTableCell cell = tableView.GetReusableCell(m_cellPrefab.reuseIdentifier) as DetailTableCell; if (cell == null) { cell = (DetailTableCell)GameObject.Instantiate(m_cellPrefab); cell.name = "DynamicHeightCellInstance_" + (++m_numInstancesCreated).ToString(); cell.onCellHeightChanged.AddListener(OnCellHeightChanged); } cell.rowNumber = row; cell.height = GetHeightOfRow(row); cell.m_rowNumberText.text = fileinfo [row].Name; return(cell); }
void Update() { m_tableView.scrollY -= Time.deltaTime * scrollingVelocity; if (playIsGazing) { playGazeActivationTime += Time.deltaTime; float r = 1.0f - (playGazeActivationTime / playGazeActivationThreshold); float g = r; float b = r; btnPlay.GetComponent <Image>().color = new Color(r, 1.0f, b, 1.0f); if (playGazeActivationTime > playGazeActivationThreshold) { play(); //run the activation method for the play button playGazeActivationTime = 0.0f; } } else { playGazeActivationTime = 0.0f; } //DetailTableCell temp = m_tableView.GetCellAtRow (0) as DetailTableCell; //temp.GetComponent<Image> ().color = new Color(0.5f, 0.5f, 1.0f, 0.75f); //Debug.Log (m_tableView.visibleRowRange.from ); selectedCellIndex = (int)(m_numRows * (m_tableView.scrollY / m_tableView.scrollableHeight)); selectedCellIndex = Mathf.Clamp(selectedCellIndex, 0, m_numRows - 1); for (int i = 0; i < m_numRows; i++) { DetailTableCell temp = m_tableView.GetCellAtRow(i) as DetailTableCell; if (temp != null) { temp.GetComponent <Image>().color = Color.white; if (temp.rowNumber == selectedCellIndex) { temp.GetComponent <Image>().color = new Color(0.5f, 0.5f, 1.0f, 0.5f); } } } }