public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { CellView cellView = scroller.GetCellView(cellViewPrefab) as CellView; cellView.name = "Cell " + dataIndex.ToString(); cellView.SetData(_data[dataIndex], dataIndex, _data[dataIndex].collapsedSize, _data[dataIndex].expandedSize, InitializeTween, TweenUpdated, TweenEnd); return(cellView); }
/// <summary> /// Gets the cell to be displayed. You can have numerous cell types, allowing variety in your list. /// Some examples of this would be headers, footers, and other grouping cells. /// </summary> /// <param name="scroller">The scroller requesting the cell</param> /// <param name="dataIndex">The index of the data that the scroller is requesting</param> /// <param name="cellIndex">The index of the list. This will likely be different from the dataIndex if the scroller is looping</param> /// <returns>The cell for the scroller to use</returns> public EnhancedScrollerCellView GetCellView(EnhancedScroller scroller, int dataIndex, int cellIndex) { // first, we get a cell from the scroller by passing a prefab. // if the scroller finds one it can recycle it will do so, otherwise // it will create a new cell. CellView cellView = scroller.GetCellView(cellViewPrefab) as CellView; cellView.name = "Cell " + dataIndex.ToString(); // pass in a reference to our data cellView.SetData(_data[dataIndex], dataIndex, _data[dataIndex].collapsedSize, _data[dataIndex].expandedSize, TweenStart, TweenUpdated, TweenEnd); // return the cell to the scroller return(cellView); }