hch
3 天以前 6ae4b14b7fb6640ec805f070a1f0f691941c6917
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
36
37
38
39
40
41
42
43
using System.Collections.Generic;
using UnityEngine;
 
public class HeroFatesAttrCell : MonoBehaviour
{
    [SerializeField] HeroFatesAttrItem[] items;
 
    HeroFatesManager manager { get { return HeroFatesManager.Instance; } }
 
    public void Display(int rowIndex, List<int> totalAttrIdList, Dictionary<int, long> totalAttrDict)
    {
        if (totalAttrIdList.IsNullOrEmpty() || totalAttrDict.IsNullOrEmpty())
        {
            return;
        }
 
        for (int i = 0; i < items.Length; i++)
        {
            int index = rowIndex * manager.attrRowCountMax + i;
            if (index < totalAttrIdList.Count)
            {
                if (index >= totalAttrIdList.Count || index < 0)
                {
                    continue;
                }
                int attrId = totalAttrIdList[index];
                if (!totalAttrDict.ContainsKey(attrId))
                {
                    continue;
                }
                long attrValue = totalAttrDict[attrId];
 
                items[i].SetActive(true);
                items[i].Display(attrId, attrValue);
            }
            else
            {
                items[i].SetActive(false);
            }
        }
 
    }
}