You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using EnhancedUI.EnhancedScroller;
|
|
|
|
namespace EnhancedScrollerDemos.SnappingDemo
|
|
{
|
|
public class SlotCellView : EnhancedScrollerCellView
|
|
{
|
|
/// <summary>
|
|
/// These are the UI elements that will be updated when the data changes
|
|
/// </summary>
|
|
public Image slotImage;
|
|
|
|
/// <summary>
|
|
/// This function sets up the data for the cell view
|
|
/// </summary>
|
|
/// <param name="data">The data to use</param>
|
|
public void SetData(SlotData data)
|
|
{
|
|
// update the cell view's UI
|
|
if (data.sprite == null)
|
|
{
|
|
// this is a blank slot, so set the background color to no alpha
|
|
slotImage.color = new Color(0, 0, 0, 0);
|
|
}
|
|
else
|
|
{
|
|
// this slot has an image so set its sprite
|
|
slotImage.sprite = data.sprite;
|
|
slotImage.color = Color.white;
|
|
}
|
|
}
|
|
}
|
|
}
|