少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, April 22, 2019
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using LitJson;
 
namespace vnxbqy.UI
{
 
    public class RealmPromoteWin : Window
    {
        [SerializeField] Text m_FightPoint;
        [SerializeField] PropertyBehaviour[] m_Propertys;
        [SerializeField] Text m_ReikiPoint;
        [SerializeField] Text m_ReikiText;
        [SerializeField] Text m_SkillName;
        [SerializeField] Text m_SkillText;
        [SerializeField] Image m_RealmIcon;
        [SerializeField] Image m_beforeRealmIcon;
        [SerializeField] UIEffect m_Effect;
        [SerializeField] Button m_Close;
        [SerializeField] Text unLockEquip;
 
        [SerializeField] Transform m_CloseRemind;
 
        int realmLevel = 0;
 
        static Dictionary<int, int> propertys = new Dictionary<int, int>();
 
        float timer = 0f;
 
        RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } }
 
        #region Built-in
        protected override void BindController()
        {
        }
 
        protected override void AddListeners()
        {
            m_Close.AddListener(OnClickClose);
        }
 
        protected override void OnPreOpen()
        {
            realmLevel = PlayerDatas.Instance.baseData.realmLevel;
            timer = 0f;
            m_CloseRemind.SetActive(false);
            Dispaly();
        }
 
        protected override void OnAfterOpen()
        {
        }
 
        protected override void OnPreClose()
        {
        }
 
        protected override void OnAfterClose()
        {
        }
 
        protected override void LateUpdate()
        {
            timer += Time.deltaTime;
            if (timer >= 1f)
            {
                if (!m_CloseRemind.gameObject.activeSelf)
                {
                    m_CloseRemind.SetActive(true);
                }
            }
        }
        #endregion
 
        private void OnClickClose()
        {
            if (timer >= 2f)
            {
                CloseClick();
            }
        }
 
        void Dispaly()
        {
            propertys.Clear();
 
            var currentConfig = RealmConfig.Get(realmLevel);
            var lastConfig = RealmConfig.Get(realmLevel - 1);
 
            for (int i = 0; i < currentConfig.AddAttrType.Length; i++)
            {
                propertys.Add(currentConfig.AddAttrType[i], currentConfig.AddAttrNum[i]);
            }
            if (lastConfig.AddAttrType != null && lastConfig.AddAttrType.Length > 0)
            {
                for (int i = 0; i < lastConfig.AddAttrType.Length; i++)
                {
                    var property = lastConfig.AddAttrType[i];
                    if (propertys.ContainsKey(property))
                    {
                        propertys[property] -= lastConfig.AddAttrNum[i];
                    }
                }
            }
 
            var fightPoint = UIHelper.GetFightPower(propertys);
            m_FightPoint.text = UIHelper.ReplaceLargeArtNum(fightPoint);
 
            for (int i = 0; i < m_Propertys.Length; i++)
            {
                m_Propertys[i].SetActive(i < currentConfig.AddAttrType.Length);
                if (i < currentConfig.AddAttrType.Length)
                {
                    var property = currentConfig.AddAttrType[i];
                    m_Propertys[i].DisplayRealm(property, currentConfig.AddAttrNum[i] - propertys[property], currentConfig.AddAttrNum[i]);
                }
            }
 
 
            unLockEquip.SetActive(false);
            m_SkillText.SetActive(false);
            m_ReikiText.SetActive(false);
 
            if (currentConfig.AddFreePoint != 0)
            {
                m_ReikiText.SetActive(true);
                m_ReikiPoint.text = currentConfig.AddFreePoint.ToString();
                m_ReikiText.text = Language.Get("Z2007");
            }
 
            else if (currentConfig.LearnSkillIDInfo.Count > 0)
            {
                m_SkillText.SetActive(true);
                var array = currentConfig.LearnSkillIDInfo[PlayerDatas.Instance.baseData.Job];
                var skillConfig = SkillConfig.Get(array[0]);
 
                m_SkillName.text = skillConfig.SkillName;
                m_SkillText.text = Language.Get("Z2008");
            }
            else if (currentConfig.EquipLV > 0) 
            {
                unLockEquip.SetActive(true);
                unLockEquip.text = Language.Get("MountPanel_UnlockBtn_1") + Language.Get("RealmEquipName", currentConfig.NameEx);
            }
            
 
            m_RealmIcon.SetSprite(currentConfig.Img);
            m_beforeRealmIcon.SetSprite(lastConfig.Img);
 
            var effectId = model.GetRealmCoverEffect(realmLevel);
            m_Effect.StopImediatly();
            m_Effect.effect = effectId;
            m_Effect.Play();
 
        }
 
    }
 
}