lcy
16 小时以前 2af38d4bbc58a31e85a70d5b3e9b3896f3cb0228
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using UnityEngine;
using System.Collections.Generic;
 
public class HeroReturnZhanLingPreviewCell : CellView
{
    [SerializeField] ItemCell[] itemCells;
    public const int itemCountPerRow = 5;
 
    public void Display(int rowIndex, List<Item> 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);
            }
        }
    }
}