少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
using UnityEngine;
using vnxbqy.UI;
 
public class ZhanLingHActBuyWin : Window
{
    [SerializeField] ScrollerController allScroller; //所有等级奖励
    [SerializeField] ScrollerController nowScroller; //当前等级奖励
    [SerializeField] ButtonEx btnClose;
    [SerializeField] ButtonEx btnBuy;
    [SerializeField] TextEx txtBuy;
    [SerializeField] ImageEx imgBK;
    [SerializeField] ImageEx imgTitle;
    [SerializeField] TextEx txtPercentage;
    [SerializeField] TextEx txtMoneyCount;
    [SerializeField] Canvas canvas;
 
    TextEx orgPrice;
 
    VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
    ZhanLingHActBuyModel model { get { return ModelCenter.Instance.GetModel<ZhanLingHActBuyModel>(); } }
    int ctgID;
 
    protected override void BindController()
    {
        var obj = btnBuy.FindComponent("Text", "Txt_orgPrice");
        if (obj != null)
            orgPrice = obj as TextEx;
 
        canvas.sortingLayerName = "UI";
    }
 
    protected override void AddListeners()
    {
        btnClose.SetListener(CloseClick);
        btnBuy.SetListener(() =>
        {
            if (ctgID == 0)
            {
                CloseClick();
                return;
            }
            vipModel.CTG(ctgID);
            CloseClick();
        });
    }
 
    protected override void OnPreOpen()
    {
        allScroller.OnRefreshCell += OnScrollerRefreshAllCell;
        nowScroller.OnRefreshCell += OnScrollerRefreshNowCell;
        Display();
    }
 
    protected override void OnPreClose()
    {
        allScroller.OnRefreshCell -= OnScrollerRefreshAllCell;
        nowScroller.OnRefreshCell -= OnScrollerRefreshNowCell;
    }
 
    protected override void OnAfterOpen()
    {
        CreateAllScroller();
        CreateNowScroller();
    }
 
    protected override void OnAfterClose()
    {
    }
 
    private void OnScrollerRefreshAllCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell as ZhanLingHActBuyAllCell;
        _cell.Display(_cell.index);
    }
 
    private void OnScrollerRefreshNowCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell as ZhanLingHActBuyNowCell;
        _cell.Display(_cell.index);
    }
 
    private void Display()
    {
        ctgID = model.GetCtgID();
        if (!CTGConfig.Has(ctgID))
        {
            CloseClick();
            return;
        }
        OrderInfoConfig orderCfg;
        vipModel.TryGetOrderInfo(ctgID, out orderCfg);
 
        txtMoneyCount.text = UIHelper.GetMoneyCnt(1).ToString();
 
        string bkStr = StringUtility.Contact("ZhanLingHBuyActBK", "_", model.zhanLingType);
        if (IconConfig.Has(bkStr))
            imgBK.SetSprite(bkStr);
 
        string titleStr = StringUtility.Contact("ZhanLingHBuyActTitle", "_", model.zhanLingType, "_", model.showGiftType);
        if (IconConfig.Has(titleStr))
        {
            imgTitle.SetSprite(titleStr);
            imgTitle.SetNativeSize();
        }
 
        txtPercentage.text = Language.Get("BlessedLand039", CTGConfig.Get(ctgID).Percentage);
        txtBuy.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(orderCfg.PayRMBNum));
        if (orgPrice != null)
        {
            orgPrice.SetActiveIL(PlayerDatas.Instance.baseData.IsActive90Off);
            orgPrice.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(orderCfg.m_PayRMBNum));
        }
    }
 
    private void CreateAllScroller()
    {
        var items = model.GetGiftAllItem();
        allScroller.Refresh();
        for (int i = 0; i < items.Count; i++)
        {
            allScroller.AddCell(ScrollerDataType.Header, i);
        }
        allScroller.Restart();
    }
 
    private void CreateNowScroller()
    {
        var items = model.GetGiftNowItem();
        nowScroller.Refresh();
        for (int i = 0; i < items.Count; i++)
        {
            nowScroller.AddCell(ScrollerDataType.Header, i);
        }
        nowScroller.Restart();
    }
}