少年修仙传客户端代码仓库
lcy
2025-05-08 1314c3b3c14cd520bbb8569b5f98d68933a22cd3
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 System.Linq;
using UnityEngine;
 
namespace vnxbqy.UI
{
    public class FairySiegeGuessCell : CellView
    {
        [SerializeField] List<FairySiegeGuessCellItem> items = new List<FairySiegeGuessCellItem>();
        FairySiegeActModel model { get { return ModelCenter.Instance.GetModel<FairySiegeActModel>(); } }
 
        public void Display(int rowIndex)
        {
            var list = model.guessFamilyListDict.Keys.ToList();
            list.Sort((a, b) =>
            {
                var guessValueA = model.guessFamilyListDict[a];
                var guessValueB = model.guessFamilyListDict[b];
                if (guessValueA != guessValueB)
                {
                    return guessValueB.CompareTo(guessValueA);
                }
                return 0;
            });
 
            for (var i = 0; i < items.Count; i++)
            {
                var item = items[i];
                var index = rowIndex * model.ScrRowCntMax + i;
                if (index < list.Count)
                {
                    item.SetActive(true);
                    var fairyId = list[index];
                    item.Display((int)fairyId);
                }
                else
                {
                    item.SetActive(false);
                }
            }
        }
    }
}