少年修仙传客户端代码仓库
hch
2025-07-24 50e53441950268933694eeb5aad36147bbe1014d
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
using System.Collections.Generic;
using UnityEngine;
 
namespace vnxbqy.UI
{
    public class YunShiRechargeGiftActCell : CellView
    {
        [SerializeField] TextEx txtTitle;
 
        [SerializeField] List<CustomizedItemCell> itemCells;
        [SerializeField] ButtonEx btnBuy;
        [SerializeField] TextEx txtPrice;
        [SerializeField] ImageEx imgBuyYet;
        [SerializeField] ImageEx imgProfitRatio;
        [SerializeField] TextEx txtProfitRatio;
        [SerializeField] TextEx txtLimitCount;
        [SerializeField] ImageEx imgRed;
        [SerializeField] TextEx orgPrice;
 
        YunShiRechargeGiftActModel model { get { return ModelCenter.Instance.GetModel<YunShiRechargeGiftActModel>(); } }
        VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
 
        StoreModel storeModel { get { return ModelCenter.Instance.GetModel<StoreModel>(); } }
        CustomizedRechargeModel customizedRechargeModel { get { return ModelCenter.Instance.GetModel<CustomizedRechargeModel>(); } }
 
        public void Display(int index)
        {
            OperationRechargeGiftAct act;
            OperationTimeHepler.Instance.TryGetOperation(YunShiRechargeGiftActModel.operaType, out act);
            if (act == null)
                return;
            imgRed.SetActive(false);
 
            List<StoreConfig> _list = null;
            StoreConfig.TryGetStoreConfigs(act.shopType, out _list);
 
            if (_list != null && index < _list.Count)
            {
                DisplayStore(_list[index]);
                return;
            }
            index = index - (_list != null ? _list.Count : 0);
 
            int ctgID = act.ctgIDs[index];
            var ctgConfig = CTGConfig.Get(ctgID);
            txtTitle.text = ctgConfig.Title;
 
            var countInfo = model.GetBuyCntInfo(ctgID);
 
            int buyCnt = countInfo.x;
            int totalCnt = countInfo.y;
 
            customizedRechargeModel.ShowUIItems(itemCells, ctgID);
 
            btnBuy.SetActive(buyCnt < totalCnt);
            btnBuy.SetListener(() =>
            {
                if (PlayerDatas.Instance.baseData.VIPLv < ctgConfig.VipLevel)
                {
                    SysNotifyMgr.Instance.ShowTip("VIPNotEnough", ctgConfig.VipLevel);
                    return;
                }
                vipModel.CTG(ctgID);
            });
            imgBuyYet.SetActive(buyCnt >= totalCnt);
 
            OrderInfoConfig orderConfig;
            vipModel.TryGetOrderInfo(ctgID, out orderConfig);
            imgProfitRatio.SetActive(orderConfig != null);
            txtPrice.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(orderConfig.PayRMBNum));
            txtLimitCount.SetActive(true);
            txtLimitCount.text = Language.Get("YunShi03", UIHelper.AppendColor(buyCnt >= totalCnt ? TextColType.Red : TextColType.DarkGreen, Mathf.Max(0, totalCnt - buyCnt).ToString(), true));
 
            if (orgPrice != null)
            {
                orgPrice.SetActive(PlayerDatas.Instance.baseData.IsActive90Off);
                orgPrice.text = Language.Get("PayMoneyNum", UIHelper.GetMoneyFormat(orderConfig.m_PayRMBNum));
            }
 
            txtProfitRatio.text = Language.Get("BlessedLand039", ctgConfig.Percentage);
        }
 
        private void DisplayStore(StoreConfig storeConfig)
        {
            bool isFree = storeConfig.MoneyNumber == 0;
            txtTitle.text = isFree ? Language.Get("StoreName_free") : Language.Get("StoreName_money");
            imgRed.SetActive(isFree);
            orgPrice.SetActive(false);
            int remainNum;
            storeModel.TryGetIsSellOut(storeConfig, out remainNum);
 
            var items = storeModel.GetShopItemlistByIndex(storeConfig);
 
            for (int i = 0; i < itemCells.Count; i++)
            {
                var itemBaisc = itemCells[i];
                if (i < items.Count)
                {
                    var itemInfo = items[i];
                    itemBaisc.SetActive(true);
                    ItemCellModel cellModel = new ItemCellModel(itemInfo.itemId, false, (ulong)itemInfo.count);
                    itemBaisc.Init(cellModel);
                    itemBaisc.button.AddListener(() =>
                    {
                        ItemTipUtility.Show(itemInfo.itemId);
                    });
                }
                else
                {
                    itemBaisc.SetActive(false);
                }
            }
 
            btnBuy.SetActive(remainNum > 0);
            btnBuy.SetListener(() =>
            {
                storeModel.SendBuyShopItemWithPopCheck(storeConfig, 1, (int)BuyStoreItemCheckType.ActGift);
            });
            imgBuyYet.SetActive(remainNum <= 0);
 
            txtPrice.text = isFree ? Language.Get("AloneFree") : Language.Get("ItemOverdue105", storeConfig.MoneyNumber);
            imgProfitRatio.SetActive(false);
            txtLimitCount.SetActive(!isFree);
            txtLimitCount.text = Language.Get("CycleHall06", UIHelper.AppendColor(remainNum == 0 ? TextColType.Red : TextColType.DarkGreen, Mathf.Max(0, remainNum).ToString(), true));
        }
    }
}