少年修仙传客户端代码仓库
hch
2024-12-16 9377811d0ba27047e1e5ec2348a28eba1033d59d
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Wednesday, July 18, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
 
namespace vnxbqy.UI
{
 
    public class PersonalBossVipLackWin : Window
    {
        [SerializeField] Text m_Tip;
        [SerializeField] Text m_Vip;
 
        [SerializeField] Button m_ViewVip;
        [SerializeField] Button m_Close;
 
 
        VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
 
        #region Built-in
        protected override void BindController()
        {
        }
 
        protected override void AddListeners()
        {
            m_ViewVip.AddListener(ViewVip);
            m_Close.AddListener(CloseClick);
        }
 
        protected override void OnPreOpen()
        {
            DisplayBaseInfo();
        }
 
        protected override void OnAfterOpen()
        {
        }
 
        protected override void OnPreClose()
        {
        }
 
        protected override void OnAfterClose()
        {
        }
        #endregion
 
 
        private void DisplayBaseInfo()
        {
            var vipLevel = PlayerDatas.Instance.baseData.VIPLv;
            var privilegeCount = vipModel.GetVipPrivilegeCnt(VipPrivilegeType.SelfBoss);
 
            var nextPrivilegeCount = privilegeCount;
            var nextVipLevel = (int)vipLevel;
            for (int i = vipLevel + 1; i <= vipModel.vipMaxLv; i++)
            {
                var count = VipPrivilegeConfig.GetVipPrivilegeData(VipPrivilegeType.SelfBoss, i);
                if (count > nextPrivilegeCount)
                {
                    nextPrivilegeCount = count;
                    nextVipLevel = i;
                    break;
                }
            }
 
            if (nextPrivilegeCount > privilegeCount)
            {
                m_Vip.text = nextVipLevel.ToString();
                var rechargeCount = vipModel.GetVipPreExp(nextVipLevel) - vipModel.vipTotalExp;
                m_Tip.text = Language.Get("VIPBossLack1", rechargeCount, nextVipLevel, nextPrivilegeCount - privilegeCount);
            }
            else
            {
                m_Vip.text = vipLevel.ToString();
                m_Tip.text = Language.Get("VIPBossLack2");
            }
        }
 
        private void ViewVip()
        {
            WindowCenter.Instance.Close<PersonalBossVipLackWin>();
            WindowCenter.Instance.Open<VipRechargeWin>(false, 1);
        }
    }
 
}