少年修仙传客户端代码仓库
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
using vnxbqy.UI;
using UnityEngine;
 
public class ZhanLingHBuyWin : Window
{
    [SerializeField] ScrollerController scroller;
    [SerializeField] ButtonEx btnClose;
    [SerializeField] ButtonEx btnBuy;
    [SerializeField] TextEx txtBuy;
    [SerializeField] TextEx txtTitle;
    [SerializeField] ImageEx imgBK;
    [SerializeField] TextEx txtPercentage;
    [SerializeField] Canvas canvas;
 
    TextEx orgPrice;
 
    VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
    ZhanLingHBuyModel model { get { return ModelCenter.Instance.GetModel<ZhanLingHBuyModel>(); } }
    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()
    {
        
        scroller.OnRefreshCell += OnScrollerRefreshCell;
        Display();
    }
 
    void Display()
    {
        ctgID = model.GetCtgID();
        if (ctgID == 0)
        {
            CloseClick();
            return;
        }
        OrderInfoConfig orderCfg;
        vipModel.TryGetOrderInfo(ctgID, out orderCfg);
        if (model.bgIconkey != null)
        {
            imgBK.SetSprite(model.bgIconkey);
        }
        txtTitle.text = CTGConfig.Get(ctgID).Title;
        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));
        }
    }
 
    void CreateScroller()
    {
        var list = model.GetGiftAllItem();
        scroller.Refresh();
        for (int i = 0; i < list.Count; i++)
        {
            scroller.AddCell(ScrollerDataType.Header, i);
        }
        scroller.Restart();
    }
 
    protected override void OnAfterOpen()
    {
        CreateScroller();
    }
 
    protected override void OnPreClose()
    {
        scroller.OnRefreshCell -= OnScrollerRefreshCell;
    }
 
 
    private void OnScrollerRefreshCell(ScrollerDataType type, CellView cell)
    {
        var _cell = cell as ZhanLingHBuyCell;
        _cell.Display(_cell.index);
    }
 
    protected override void OnAfterClose()
    {
 
    }
}