少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
//--------------------------------------------------------
//    [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] UIEffect m_Effect;
        [SerializeField] Button m_Close;
 
        [SerializeField] Transform m_CloseRemind;
 
        public static 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()
        {
            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 >= 2f)
            {
                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 = fightPoint.ToString();
 
            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]);
                }
            }
            m_ReikiPoint.text = string.Empty;
            m_ReikiText.text = string.Empty;
            m_SkillName.text = string.Empty;
            m_SkillText.text = string.Empty;
            if (currentConfig.AddFreePoint != 0)
            {
                m_ReikiPoint.text = currentConfig.AddFreePoint.ToString();
                m_ReikiText.text = Language.Get("Z2007");
            }
 
            var config = RealmConfig.Get(realmLevel);
            if (config.LearnSkillIDInfo.Length > 4)
            {
                var json = JsonMapper.ToObject(config.LearnSkillIDInfo);
                var array = JsonMapper.ToObject<int[]>(json[PlayerDatas.Instance.baseData.Job.ToString()].ToJson());
                var skillConfig = SkillConfig.Get(array[0]);
 
                m_SkillName.text = skillConfig.SkillName;
                m_SkillText.text = Language.Get("Z2008");
            }
            
 
            m_RealmIcon.SetSprite(currentConfig.Img);
 
            var effectId = model.GetRealmCoverEffect(realmLevel);
            m_Effect.StopImediatly();
            m_Effect.effect = effectId;
            m_Effect.Play();
        }
 
    }
 
}