少年修仙传客户端代码仓库
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
51
52
53
54
55
56
57
58
59
60
61
62
63
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Wednesday, September 26, 2018
//--------------------------------------------------------
using UnityEngine;
using System.Collections.Generic;
 
 
namespace vnxbqy.UI
{
 
    public class CustomizedGiftChooseCell : CellView
    {
        [SerializeField] List<ItemCell> itemCells;
        [SerializeField] List<ImageEx> images;
 
        CustomizedRechargeModel model { get { return ModelCenter.Instance.GetModel<CustomizedRechargeModel>(); } }
 
 
 
        public void Display(int index)
        {
            var selectItemInfo = CTGConfig.Get(model.chooseCTGID).SelectItemInfo;
            int chooseCount = selectItemInfo.Length;
 
            for (int i = 0; i < itemCells.Count; i++)
            {
                int itemIndex = index * 7 + i;
                if (itemIndex < selectItemInfo[model.chooseWinIndex].Length)
                {
                    int selectID = selectItemInfo[model.chooseWinIndex][itemIndex];
                    int itemId = CTGSelectItemConfig.Get(selectID).ItemID;
                    int count = CTGSelectItemConfig.Get(selectID).ItemCount;
                    var itemData = new ItemCellModel((int)itemId, false, (ulong)count);
                    images[i].SetActive(model.GetChooseSubIndex(model.chooseWinIndex) - 1 == i);
                    itemCells[i].SetActive(true);
                    itemCells[i].Init(itemData);
                    itemCells[i].button.SetListener(() =>
                    {
                        model.chooseIndexDict[model.chooseWinIndex] = itemIndex + 1;
                        //选中后跳下一个
                        if (model.chooseWinIndex + 1 < chooseCount)
                        {
                            model.chooseWinIndex += 1;
                        }
                        else
                        {
                            model.chooseWinIndex = 0;
                        }
 
                        model.UpdateWin?.Invoke();
                    });
                }
                else
                {
                    images[i].SetActive(false);
                    itemCells[i].SetActive(false);
                }
            }
        }
    }
 
}