lcy
2 天以前 df5481265f8bf04548c8f51e5fffc9449547f423
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
using System;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
 
/// <summary>
/// 古宝套装列表
/// </summary>
public class GubaoSuiteListWin : UIBase
{
    [SerializeField] ScrollerController scroller;
 
 
    protected override void OnPreOpen()
    {
        scroller.OnRefreshCell += OnRefreshCell;
        UIManager.Instance.OnCloseWindow += OnCloseWindow;
        Display();
    }
 
    protected override void OnPreClose()
    {
        scroller.OnRefreshCell -= OnRefreshCell;
        UIManager.Instance.OnCloseWindow -= OnCloseWindow;
    }
 
    void OnCloseWindow(UIBase ui)
    {
        if (ui is GubaoDetailWin)
        {
            scroller.m_Scorller.RefreshActiveCellViews();
        }
    }
 
 
    void Display()
    {
        scroller.Refresh();
        var keys = GubaoResonanceConfig.GetKeys();
        keys.Sort((a, b) => GubaoResonanceConfig.Get(a).sortIndex.CompareTo(GubaoResonanceConfig.Get(b).sortIndex));
        for (int i = 0; i < keys.Count; i++)
        {
            scroller.AddCell(ScrollerDataType.Header, keys[i]);
            
        }
 
        scroller.Restart();
        scroller.JumpIndex(GubaoManager.Instance.jumpSuiteID - 1);
        GubaoManager.Instance.jumpSuiteID = 0;
        GubaoManager.Instance.UpdateRedpoint();
    }
 
    void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell as GubaoSuiteListCell;
        _cell.Display(cell.index);
    }
}