using UnityEngine; using System.Collections.Generic; public class HeroReturnZhanLingPreviewCell : CellView { [SerializeField] ItemCell[] itemCells; public const int itemCountPerRow = 5; public void Display(int rowIndex, List items) { if (items == null) return; for (int i = 0; i < itemCells.Length; i++) { int index = rowIndex * itemCountPerRow + i; if (index < items.Count) { itemCells[i].SetActive(true); int itemID = items[index].id; long count = items[index].countEx; itemCells[i].Init(new ItemCellModel(itemID, false, count)); int clickItemId = itemID; itemCells[i].button.AddListener(() => { ItemTipUtility.Show(clickItemId); }); } else { itemCells[i].SetActive(false); } } } }