少年修仙传客户端代码仓库
hch
2025-07-02 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
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
using UnityEngine.UI;
using UnityEngine;
using vnxbqy.UI;
using System.Collections.Generic;
 
public class Buy1Free5Cell : ILBehaviour
{
    List<ItemCell> items = new List<ItemCell>();
    Button buyBtn;
    Text buyBtnTxt;
    ImageEx freeLock;
    Image stateImg;
    TextEx orgPrice;
 
    VipModel vipModel { get { return ModelCenter.Instance.GetModelEx<VipModel>(); } }
    protected override void Awake()
    {
        buyBtn = proxy.GetWidgtEx<Button>("BuyButton");
        buyBtnTxt = proxy.GetWidgtEx<Text>("Text");
        freeLock = proxy.GetWidgtEx<ImageEx>("lockimg");
        stateImg = proxy.GetWidgtEx<Image>("BoughtObj");
        for (int i = 0; i < 2; i++)
        {
            items.Add(proxy.GetWidgtEx<ItemCell>("ItemCell" + i));
        }
 
        var obj = buyBtn.FindComponent("Text", "Txt_orgPrice");
        if (obj != null)
            orgPrice = obj as TextEx;
    }
 
    public void Display(int index)
    {
        OperationBuy1Free5 operation;
        if (!OperationTimeHepler.Instance.TryGetOperation(Buy1Free5Model.operationType, out operation))
        {
            return;
        }
        int actNum = operation.ActNum;
        int ctgID = operation.indexToCTGIDDict[Buy1Free5Model.Instance.selectCTGIDIndex];
        VipModel.RechargeCount rechargeCount;
        vipModel.TryGetRechargeCount(ctgID, out rechargeCount);
        if (index == 0)
        {
            buyBtn.SetActiveIL(rechargeCount.todayCount == 0);
            buyBtn.AddListener(() =>
            {
                vipModel.CTG(ctgID);
            });
            OrderInfoConfig config;
            vipModel.TryGetOrderInfo(ctgID, out config);
            buyBtnTxt.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(config.PayRMBNum));
            if (orgPrice != null)
            {
                orgPrice.SetActiveIL(PlayerDatas.Instance.baseData.IsActive90Off);
                orgPrice.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(config.m_PayRMBNum));
            }
 
            freeLock.SetActiveIL(false);
            stateImg.SetActiveIL(rechargeCount.todayCount != 0);
 
            List<Item> awards = new List<Item>();
            vipModel.TryGetRechargeItem(ctgID, out awards);
            for (int i = 0; i < items.Count; i++)
            {
                if (awards != null && i < awards.Count)
                {
                    items[i].SetActiveIL(true);
                    var itemId = awards[i].id;
                    var model = new ItemCellModel(itemId, false, (ulong)awards[i].count);
                    items[i].Init(model);
                    items[i].auctionIcon.SetActiveIL(awards[i].bind != 0);
                    items[i].button.SetListener(() =>
                    {
                        ItemTipUtility.Show(itemId);
                    });
                }
                else
                {
                    items[i].SetActiveIL(false);
                }
            }
        }
        else
        {
            int freeIndex = index - 1;
 
            var state = Buy1Free5Model.Instance.GetFreeGiftState(Buy1Free5Model.Instance.selectCTGIDIndex, ctgID, freeIndex);
            buyBtn.SetActiveIL(state != 2);
            buyBtn.AddListener(() =>
            {
                if (state == 1)
                {
                    var pak = new IL_CA504_tagCMPlayerGetReward();
                    pak.RewardType = 60;
                    pak.DataEx = (uint)(Buy1Free5Model.Instance.selectCTGIDIndex * 100 + freeIndex); // 奖励索引
                    pak.DataExStr = actNum.ToString(); // 活动编号
                    pak.DataExStrLen = (byte)pak.DataExStr.Length;
                    GameNetSystem.Instance.SendInfo(pak);
                }
                else
                {
                    SysNotifyMgr.Instance.ShowTip("Buy1Free5");
                }
            });
 
            buyBtnTxt.text = Language.Get("Z2014");
            freeLock.SetActiveIL(state != 1);
            stateImg.SetActiveIL(state == 2);
 
 
            var awards = operation.CTGIDToFreeDict[ctgID][freeIndex];
            for (int i = 0; i < items.Count; i++)
            {
                if (i < awards.Count)
                {
                    items[i].SetActiveIL(true);
                    var itemId = awards[i].id;
                    var model = new ItemCellModel(itemId, false, (ulong)awards[i].count);
                    items[i].Init(model);
                    items[i].auctionIcon.SetActiveIL(awards[i].bind != 0);
                    items[i].button.SetListener(() =>
                    {
                        ItemTipUtility.Show(itemId);
                    });
                }
                else
                {
                    items[i].SetActiveIL(false);
                }
            }
        }
    }
 
}