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.Collections.Generic;
using UnityEngine;
 
public class EquipRecordWin : UIBase
{
    [SerializeField] ScrollerController scroller;
    [SerializeField] Transform transNo;
    [SerializeField] TextEx txtTip;
    EquipRecordManager manager { get { return EquipRecordManager.Instance; } }
    protected override void OnPreOpen()
    {
 
        scroller.OnRefreshCell += OnRefreshCell;
        manager.OnUpdateRecordListEvent += OnUpdateRecordListEvent;
        txtTip.text = Language.Get("AutoFight17", manager.maxCnt);
        scroller.lockType = EnhanceLockType.KeepVertical;
        CreateScroller(isSort: true, isjump: true);
    }
 
    protected override void OnPreClose()
    {
        scroller.OnRefreshCell -= OnRefreshCell;
        manager.OnUpdateRecordListEvent -= OnUpdateRecordListEvent;
    }
 
    private void OnUpdateRecordListEvent()
    {
        CreateScroller();
    }
 
    private void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell.GetComponent<EquipRecordCell>();
        _cell?.Display(cell.index, list);
    }
    List<EquipRecordManager.EquipRecordData> list;
 
    private void CreateScroller(bool isSort = false, bool isjump = false)
    {
        scroller.Refresh();
        list = manager.GetRecordList(isSort);
        bool isNullOrEmpty = list.IsNullOrEmpty();
        transNo.SetActive(isNullOrEmpty);
        if (!isNullOrEmpty)
        {
            for (int i = list.Count - 1; i >= 0; i--)
            {
                scroller.AddCell(ScrollerDataType.Header, i);
            }
        }
        scroller.Restart();
        if (isjump)
        {
            scroller.JumpIndex(0);
        }
 
    }
}