少年修仙传客户端代码仓库
hch
2025-03-19 6770e1eb64c4282def45adb824b14b2a407fdd30
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
44
45
46
using UnityEngine;
using System.Collections.Generic;
 
namespace vnxbqy.UI
{
 
    public class ExclusiveBenefitCell : CellView
    {
        [SerializeField] List<ItemCell> itemCells;
 
        ExclusiveBenefitModel model { get { return ModelCenter.Instance.GetModel<ExclusiveBenefitModel>(); } }
        VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
 
        public void Display(int index)
        {
            int ctgid = model.ctgid;
            List<Item> awards = new List<Item>();
            vipModel.TryGetRechargeItem(ctgid, out awards);
            for (int i = 0; i < itemCells.Count; i++)
            {
                int ni = i;
                int itemIndex = index * 7 + ni;
                if (itemIndex < awards.Count)
                {
                    itemCells[i].SetActive(true);
                    int itemId = awards[itemIndex].id;
                    int count = awards[itemIndex].count;
                    var itemData = new ItemCellModel((int)itemId, false, (ulong)count);
                    itemCells[i].Init(itemData);
                    itemCells[i].button.SetListener(() =>
                    {
                        ItemTipUtility.Show(itemId);
                    });
                }
                else
                {
                    itemCells[i].SetActive(false);
                }
            }
 
        }
 
 
    }
 
}