yyl
9 天以前 bb5909bcd36b48b919366c95b4248a3754452698
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
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
 
/// <summary>
/// 武将天赋总览界面
/// </summary>
public class HeroGiftWin : UIBase
{
    [SerializeField] ScrollerController scroller;
 
 
 
 
    protected override void OnPreOpen()
    {
        scroller.OnRefreshCell += OnRefreshCell;
        
        CreateScroller();
    }
 
    protected override void OnPreClose()
    {
        scroller.OnRefreshCell -= OnRefreshCell;
 
    }
 
    List<int> configList = new List<int>();
    void CreateScroller()
    {
        configList = HeroTalentConfig.GetKeys().ToList();
        var totalCount = configList.Count;
 
        scroller.Refresh();
        for (int i = 0; i < totalCount; i++)
        {
            if (i % 5 == 0)
            {
                scroller.AddCell(ScrollerDataType.Header, i);
            }
        }
        scroller.Restart();
    }
 
    void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell as HeroGiftLineCell;
        _cell.Display(cell.index, configList);
    }
 
 
}