yyl
2025-12-10 02c0f5ea45f87655389a5b392cf00268601e67bb
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
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
public class OSGalaGiftCell : CellView
{
    [SerializeField] Text nameText;
    [SerializeField] ItemCell[] itemCells;
    [SerializeField] Button buyBtn;
    [SerializeField] Text moneyText;
    [SerializeField] Image moneyIcon;
    [SerializeField] Transform saleOutRect;
    [SerializeField] Image redImg;
    [SerializeField] Text buyLimitText;
    [SerializeField] Image maskImg;
 
    public void Display(int index)
    {
        var id = OSActivityManager.Instance.osGalaGiftSortList[index];
        if (id > 100000000)
        {
            //充值
            id -= 100000000;
            var ctgConfig = CTGConfig.Get(id);
            nameText.text = ctgConfig.Title;
            for (int i = 0; i < itemCells.Length; i++)
            {
                var itemCell = itemCells[i];
                if (i < ctgConfig.GainItemList.Length)
                {
                    itemCell.SetActive(true);
                    int itemID = ctgConfig.GainItemList[i][0];
                    itemCell.Init(new ItemCellModel(itemID, true, ctgConfig.GainItemList[i][1]));
                    itemCell.button.SetListener(() => ItemTipUtility.Show(itemID));
                }
                else
                {
                    itemCell.SetActive(false);
                }
            }
            RechargeManager.Instance.TryGetRechargeCount(id, out var rechargeCount);
            var limitCnt = ctgConfig.DailyBuyCount;
            if (rechargeCount.todayCount < limitCnt)
            {
                saleOutRect.SetActive(false);
                maskImg.SetActive(false);
                buyBtn.SetActive(true);
                buyBtn.SetListener(() =>
                {
                    RechargeManager.Instance.CTG(id);
                });
 
                RechargeManager.Instance.TryGetOrderInfo(id, out var orderInfo);
 
                moneyText.text = Language.Get("PayMoneyNum", orderInfo.PayRMBNumOnSale);
                moneyIcon.SetActive(false);
            }
            else
            {
                saleOutRect.SetActive(true);
                maskImg.SetActive(true);
                buyBtn.SetActive(false);
            }
            buyLimitText.text = Language.Get("storename6", limitCnt - rechargeCount.todayCount, limitCnt);
            redImg.SetActive(false);
 
        }
        else
        {
            //商店
            var storeConfig = StoreConfig.Get(id);
            nameText.text = storeConfig.Name;
            var awards = StoreModel.Instance.GetShopItemlistEx(storeConfig);
            for (int i = 0; i < itemCells.Length; i++)
            {
                var itemCell = itemCells[i];
                if (i < awards.Count)
                {
                    itemCell.SetActive(true);
                    int itemID = awards[i][0];
                    itemCell.Init(new ItemCellModel(itemID, true, awards[i][1]));
                    itemCell.button.SetListener(() => ItemTipUtility.Show(itemID));
                }
                else
                {
                    itemCell.SetActive(false);
                }
            }
 
            var state = StoreModel.Instance.GetShopIDState(id);
            if (state == 1)
            {
                saleOutRect.SetActive(true);
                maskImg.SetActive(true);
                buyBtn.SetActive(false);
                redImg.SetActive(false);
            }
            else
            {
                saleOutRect.SetActive(false);
                maskImg.SetActive(false);
                buyBtn.SetActive(true);
                buyBtn.SetListener(() =>
                {
                    StoreModel.Instance.SendBuyShopItemWithPopCheck(storeConfig, 1);
                });
                moneyText.text = storeConfig.MoneyNum == 0 ? Language.Get("L1127") : storeConfig.MoneyNum.ToString();
                moneyIcon.SetActive(storeConfig.MoneyNum != 0);
                moneyIcon.SetIconWithMoneyType(storeConfig.MoneyType);
                redImg.SetActive(storeConfig.MoneyNum == 0);
            }   
            var buyCnt = StoreModel.Instance.GetShopLimitBuyCount(id);
            buyLimitText.text = Language.Get("storename6", storeConfig.LimitCnt - buyCnt, storeConfig.LimitCnt);
 
        }
 
    }
 
}