少年修仙传客户端代码仓库
hch
2025-03-19 6770e1eb64c4282def45adb824b14b2a407fdd30
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
namespace vnxbqy.UI
{
    public class ExclusiveBenefitModel : Model, IBeforePlayerDataInitialize
    {
        public int ctgid;
        public int[] lvArr;
        VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
 
 
        public override void Init()
        {
            //PlayerDatas.Instance.playerDataRefreshEvent += OnplayerDataRefreshEvent;
            ctgid = int.Parse(FuncConfigConfig.Get("ExclusiveBenefit").Numerical1);
            lvArr = LitJson.JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("ExclusiveBenefit").Numerical2);
        }
 
        public bool IsBuy()
        {
            VipModel.RechargeCount rechargeCount;
            vipModel.TryGetRechargeCount(ctgid, out rechargeCount);
            var ctgConfig = CTGConfig.Get(ctgid);
            int buyCnt;
            int totalCnt;
            if (ctgConfig.DailyBuyCount != 0)
            {
                buyCnt = rechargeCount.todayCount;
                totalCnt = ctgConfig.DailyBuyCount;
            }
            else
            {
                buyCnt = rechargeCount.totalCount;
                totalCnt = ctgConfig.TotalBuyCount;
            }
            return buyCnt >= totalCnt;
        }
 
        public void OnBeforePlayerDataInitialize()
        {
 
        }
 
 
        //private void OnplayerDataRefreshEvent(PlayerDataType type)
        //{
        //    if (type == PlayerDataType.LV)
        //    {
        //        for (int i = 0; i < lvArr.Length; i++)
        //        {
        //            if (PlayerDatas.Instance.baseData.LV == lvArr[i] && !IsBuy())
        //            {
        //                PopupWindowsProcessor.Instance.Add("ExclusiveBenefitWin");
        //                return;
        //            }
        //        }
        //    }
        //}
 
        public override void UnInit()
        {
            //PlayerDatas.Instance.playerDataRefreshEvent -= OnplayerDataRefreshEvent;
        }
    }
}