少年修仙传客户端代码仓库
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
using System;
using System.Collections.Generic;
 
using UnityEngine;
namespace vnxbqy.UI
{
    
    public static class ActivateShow
    {
        public static ActivateFunc activateType { get; private set; }
        public static List<PropertyCompare> propertyCompares = new List<PropertyCompare>();
        public static int fightPower { get; private set; }
        public static string titleIconKey { get; private set; }
        public static List<int> skills = new List<int>();
        public static int currentLv { get; private set; }
        public static int beforeLv { get; private set; }
        public static int godWeaponType { get; private set; }
        public static int godWeaponStage { get; private set; }
        public static int treasureSoulId { get; private set; }
 
        private static Dictionary<int, int> lastPropertyDict = new Dictionary<int, int>();
        private static Dictionary<int, int> currentPropertyDict = new Dictionary<int, int>();
 
        public static event Action<ActivateFunc, int> prepareFlySkillEvent;
        public static event Action<ActivateFunc> complelteFlySkillEvent;
 
        public static void RealmActivate(int _lv)
        {
            activateType = ActivateFunc.Realm;
            propertyCompares.Clear();
            currentPropertyDict.Clear();
            lastPropertyDict.Clear();
            beforeLv = _lv - 1;
            currentLv = _lv;
            var _beforeConfig = RealmConfig.Get(_lv - 1);
            List<int> _beforeProperties = new List<int>();
            if (_beforeConfig != null)
            {
                _beforeProperties.AddRange(_beforeConfig.AddAttrType);
                for (int i = 0; i < _beforeConfig.AddAttrType.Length; i++)
                {
                    lastPropertyDict.Add(_beforeConfig.AddAttrType[i], _beforeConfig.AddAttrNum[i]);
                }
            }
            var config = RealmConfig.Get(_lv);
            for (int i = 0; i < config.AddAttrType.Length; i++)
            {
                var _index = _beforeProperties.IndexOf(config.AddAttrType[i]);
                if (_index == -1 || config.AddAttrNum[i] > _beforeConfig.AddAttrNum[_index])
                {
                    propertyCompares.Add(new PropertyCompare()
                    {
                        key = config.AddAttrType[i],
                        beforeValue = _index == -1 ? 0 : _beforeConfig.AddAttrNum[_index],
                        currentValue = config.AddAttrNum[i]
                    });
                }
 
                currentPropertyDict.Add(config.AddAttrType[i], config.AddAttrNum[i]);
            }
            fightPower = UIHelper.GetFightPower(currentPropertyDict) - UIHelper.GetFightPower(lastPropertyDict);
            titleIconKey = "UI_JH_3";
 
            if (!WindowCenter.Instance.IsOpen<RealmPropertyUpWin>())
            {
                WindowCenter.Instance.Open<RealmPropertyUpWin>();
            }
        }
 
        public static void GodWeaponActivate(int _type, int _lv, int _beforeLv)
        {
            activateType = ActivateFunc.GodWeapon;
            currentLv = _lv;
            godWeaponType = _type;
            beforeLv = _beforeLv;
            skills.Clear();
            propertyCompares.Clear();
            lastPropertyDict.Clear();
            currentPropertyDict.Clear();
 
            var _model = ModelCenter.Instance.GetModel<MagicianModel>();
            if (_model.godWeaponSkillDict.ContainsKey(_type))
            {
                var _dict = _model.godWeaponSkillDict[_type];
                var _skillid = 0;
                if (_beforeLv == 0)
                {
                    foreach (var _key in _dict.Keys)
                    {
                        skills.Add(_dict[_key]);
                    }
                }
                else if (_model.TryGetUnlockSkill(godWeaponType, _beforeLv, _lv, out _skillid))
                {
                    skills.Add(_skillid);
                }
            }
 
            var _beforeConfig = GodWeaponConfig.GetConfig(_type, _beforeLv);
            List<int> _beforeProperties = new List<int>();
            if (_beforeConfig != null)
            {
                _beforeProperties.AddRange(_beforeConfig.AttrType);
                for (int i = 0; i < _beforeConfig.AttrType.Length; i++)
                {
                    lastPropertyDict.Add(_beforeConfig.AttrType[i], _beforeConfig.AttrNum[i]);
                }
            }
            var config = GodWeaponConfig.GetConfig(_type, currentLv);
            for (int i = 0; i < config.AttrType.Length; i++)
            {
                var _index = _beforeProperties.IndexOf(config.AttrType[i]);
                if (_index == -1 || config.AttrNum[i] > _beforeConfig.AttrNum[_index])
                {
                    propertyCompares.Add(new PropertyCompare()
                    {
                        key = config.AttrType[i],
                        beforeValue = _index == -1 ? 0 : _beforeConfig.AttrNum[_index],
                        currentValue = config.AttrNum[i]
                    });
                }
 
                currentPropertyDict.Add(config.AttrType[i], config.AttrNum[i]);
            }
 
            fightPower = UIHelper.GetFightPower(currentPropertyDict) - UIHelper.GetFightPower(lastPropertyDict);
            if (_beforeLv != 0)
            {
                for (int i = 0; i < skills.Count; i++)
                {
                    var skillConfig = SkillConfig.Get(skills[i]);
                    fightPower += skillConfig.FightPower;
                }
            }
 
            titleIconKey = _beforeLv == 0 ? "UI_JH_12" : "UI_JH_6";
 
            if (_beforeLv == 0)
            {
                var exteriorPower = 0;
                if (_model.TryGetExteriorPower(_type, out exteriorPower))
                {
                    fightPower += exteriorPower;
                }
            }
 
            if (!WindowCenter.Instance.IsOpen<RealmPropertyUpWin>())
            {
                WindowCenter.Instance.Open<RealmPropertyUpWin>();
            }
        }
 
        public static void JadeDynastySkillUnlock(int skillId)
        {
            activateType = ActivateFunc.JadeDynastySkill;
            skills.Clear();
            fightPower = 0;
            skills.Add(skillId);
            titleIconKey = "UI_JH_6";
 
            var config = SkillConfig.Get(skillId);
            if (config != null)
            {
                fightPower = config.FightPower;
            }
 
            if (!WindowCenter.Instance.IsOpen<RealmPropertyUpWin>())
            {
                WindowCenter.Instance.Open<RealmPropertyUpWin>();
            }
        }
 
        public static void PrepareSkillFly()
        {
            if (prepareFlySkillEvent != null)
            {
                prepareFlySkillEvent(activateType, skills.Count > 0 ? skills[0] : 0);
            }
        }
 
        public static void CompleteSkillFly()
        {
            if (complelteFlySkillEvent != null)
            {
                complelteFlySkillEvent(activateType);
            }
        }
 
        public enum ActivateFunc
        {
            Realm,
            GodWeapon,
            Stove, //炼丹炉升级
            JadeDynastySkill,
        }
 
        public struct PropertyCompare
        {
            public int key;
            public int beforeValue;
            public int currentValue;
        }
    }
}