少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
47
48
49
50
using UnityEngine;
using UnityEngine.UI;
using EnhancedUI.EnhancedScroller;
using System;
using System.Collections.Generic;
 
namespace vnxbqy.UI
{
    public class LuckyAwardsGroup : ScrollerUI
    {
        [SerializeField] List<AwardCell> awardCells = new List<AwardCell>();
        
        LuckyTreasureModel luckyTreasureModel { get { return ModelCenter.Instance.GetModel<LuckyTreasureModel>(); } }
 
        public override void Refresh(CellView cell)
        {
            int length = awardCells.Count;
            var treasureItems = luckyTreasureModel.GetOperation().luckTreasureItems;
 
            for (int i = 0; i < length; i++)
            {
                var awardCell = awardCells[i];
                int index = cell.index * length + i;
                if(index < treasureItems.Count-1)
                {
                    var treasureItem = treasureItems[index];
                    awardCell.itemBaisc.SetActive(true);
                    ItemCellModel itemCellModel = new ItemCellModel(treasureItem.itemId,false,(ulong)treasureItem.itemCount);
                    awardCell.itemBaisc.Init(itemCellModel);
                    awardCell.itemBaisc.button.RemoveAllListeners();
                    awardCell.itemBaisc.button.AddListener(() =>
                    {
                        ItemTipUtility.Show(treasureItem.itemId);
                    });
                }
                else
                {
                    awardCell.itemBaisc.SetActive(false);
                }
 
            }
        }
 
        [Serializable]
        public class AwardCell
        {
            public CommonItemBaisc itemBaisc;
        }
    }
}