using UnityEngine;
using UnityEngine.UI;
using EnhancedUI.EnhancedScroller;
namespace EnhancedScrollerDemos.RefreshDemo
{
///
/// This is the view of our cell which handles how the cell looks.
///
public class CellView : EnhancedScrollerCellView
{
///
/// This is a reference to the cell's underlying data.
/// We will store it in the SetData method, and use it
/// in the RefreshCellView method.
///
private Data _data;
///
/// A reference to the UI Text element to display the cell data
///
public Text someTextText;
public RectTransform RectTransform
{
get
{
var rt = gameObject.GetComponent();
return rt;
}
}
///
/// This function just takes the Demo data and displays it
///
///
public void SetData(Data data)
{
// store the data so that it can be used when refreshing
_data = data;
// update the cell's UI
RefreshCellView();
}
public override void RefreshCellView()
{
// update the UI text with the cell data
someTextText.text = _data.someText;
}
}
}