using UnityEngine;
using UnityEngine.UI;
using EnhancedUI.EnhancedScroller;
using EnhancedUI;
using System;
namespace EnhancedScrollerDemos.GridSelection
{
///
/// This delegate handles the UI's button click
///
/// The cell view that had the button click
public delegate void SelectedDelegate(RowCellView rowCellView);
///
/// This is the view of our cell which handles how the cell looks.
/// It stores references to sub cells
///
public class CellView : EnhancedScrollerCellView
{
public RowCellView[] rowCellViews;
///
/// This function just takes the Demo data and displays it
///
///
public void SetData(ref SmallList data, int startingIndex, SelectedDelegate selected)
{
// loop through the sub cells to display their data (or disable them if they are outside the bounds of the data)
for (var i = 0; i < rowCellViews.Length; i++)
{
var dataIndex = startingIndex + i;
// if the sub cell is outside the bounds of the data, we pass null to the sub cell
rowCellViews[i].SetData(dataIndex, dataIndex < data.Count ? data[dataIndex] : null, selected);
}
}
}
}