少年修仙传客户端代码仓库
hch
2025-04-03 c154ac0832fe4379a00d3e1cda700e7d2a7383c7
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
using vnxbqy.UI;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
//挑战妖王(个人BOSS)
public class ChallengeDemonKingInfoWin : Window
{
    [SerializeField] ButtonEx btnClose;
    [SerializeField] ScrollerController scroller;
    ChallengeDemonKingModel challengeDemonKingModel { get { return ModelCenter.Instance.GetModel<ChallengeDemonKingModel>(); } }
 
    protected override void BindController()
    {
 
    }
 
    protected override void AddListeners()
    {
        btnClose.SetListener(() =>
        {
            WindowCenter.Instance.Close<ChallengeDemonKingInfoWin>();
        });
    }
 
    protected override void OnPreOpen()
    {
        scroller.OnRefreshCell += OnRefreshCell;
    }
 
    protected override void OnAfterOpen()
    {
        scroller.Refresh();
        var dict = PlayerPropertyConfig.GetShowDict();
        var typeShowList = dict.Keys.ToList();
        List<int> lineList1 = new List<int>();
        List<int> lineList2 = new List<int>();
        int index = 0;
        for (int i = 0; i < typeShowList.Count; i++)
        {
            int type = typeShowList[i];
            for (int j = 0; j < dict[type].Count; j++)
            {
                if (type == 1)
                {
                    CellInfo cellInfo = new CellInfo();
                    cellInfo.infoInt1 = dict[type][j];
                    index += 1;
                    scroller.AddCell(ScrollerDataType.Header, index, cellInfo);
                }
                else if (type == 2)
                {
                    lineList1.Add(dict[type][j]);
                }
                else if (type == 3)
                {
                    lineList2.Add(dict[type][j]);
                }
            }
            int count1 = lineList1.Count;
            int count2 = lineList2.Count;
            int count = count1 <= count2 ? count1 : count2;
            for (int k = 0; k < count; k++)
            {
                CellInfo cellInfo = new CellInfo();
                cellInfo.infoInt1 = lineList1[k];
                cellInfo.infoInt2 = lineList2[k];
                index += 1;
                scroller.AddCell(ScrollerDataType.Header, index, cellInfo);
            }
        }
        scroller.Restart();
    }
 
    protected override void OnAfterClose()
    {
 
    }
 
    protected override void OnPreClose()
    {
        scroller.OnRefreshCell -= OnRefreshCell;
    }
 
    private void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell as ChallengeDemonKingInfoCell;
        _cell.Display(_cell.index, cell);
    }
 
}