少年修仙传客户端代码仓库
hch
3 天以前 600733c8f592cb9e65f2b7a3e110ac1d686e6bfe
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
93
94
95
96
97
98
99
100
101
102
103
104
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, June 11, 2019
//--------------------------------------------------------
 
using UnityEngine.UI;
using System.Collections.Generic;
using vnxbqy.UI;
using UnityEngine;
 
public class LuckyCloudAwardWin : ILWindow
{
    Button m_Close;
    Text areaName;
    ScrollerController areas;
    Transform areaObj;
    Button areaButton;
    ScrollerController awards;
 
    #region Built-in
    protected override void BindController()
    {
        m_Close = proxy.GetWidgtEx<Button>("close");
        areas = proxy.GetWidgtEx<ScrollerController>("ScrollItem");
        areaName = proxy.GetWidgtEx<Text>("DivisionNameText");
        areaButton = proxy.GetWidgtEx<Button>("PullButton");
        areaObj = proxy.GetWidgtEx<Transform>("ClickScreenOtherSpaceObj1");
        awards = proxy.GetWidgtEx<ScrollerController>("scroller");
    }
 
    protected override void AddListeners()
    {
        m_Close.SetListener(()=> {
            CloseWin<LuckyCloudAwardWin>();
        });
 
        areaButton.SetListener(()=> {
            areaObj.SetActiveIL(true);
            areas.m_Scorller.RefreshActiveCellViews();
        });
    }
 
    protected override void OnPreOpen()
    {
        areas.OnRefreshCell += OnRefreshCell;
        awards.OnRefreshCell += OnRefreshAwardCell;
        LuckyCloudBuyModel.Instance.UpdateZoneID += UpdateZoneID;
        
    }
 
    protected override void OnAfterOpen()
    {
        Display();
    }
 
    protected override void OnPreClose()
    {
        areas.OnRefreshCell -= OnRefreshCell;
        LuckyCloudBuyModel.Instance.UpdateZoneID -= UpdateZoneID;
        awards.OnRefreshCell -= OnRefreshAwardCell;
    }
 
    #endregion
 
    void Display()
    {
        areaObj.SetActiveIL(false);
        areaName.text = Language.Get("LuckyCloundBuyZoneID" + LuckyCloudBuyModel.Instance.selectZoneID);
        areas.Refresh();
        for (int i = 0; i < LuckyCloudBuyModel.Instance.m_ZoneIDList.Length; i++)
        {
            areas.AddCell(ScrollerDataType.Header, i);
        }
 
        areas.Restart();
        areas.m_Scorller.RefreshActiveCellViews();
 
        awards.Refresh();
        for (int i = LuckyCloudBuyModel.Instance.m_LotteryRecList.Count - 1; i >= 0; i--)
        {
            awards.AddCell(ScrollerDataType.Header, i);
        }
        awards.Restart();
        awards.m_Scorller.RefreshActiveCellViews();
    }
 
 
    void OnRefreshCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell.GetILBehaviour<LuckyCloudAreaCell>();
        _cell?.Display(cell.index);
    }
 
    void OnRefreshAwardCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell.GetILBehaviour<LuckyCloudAwardCell>();
        _cell?.Display(cell.index);
    }
 
    void UpdateZoneID()
    {
        Display();
    }
}