少年修仙传客户端代码仓库
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Monday, October 09, 2017
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
 
using System;
using System.Text.RegularExpressions;
 
namespace vnxbqy.UI
{
 
    public class Treasure
    {
        public int id { get; private set; }
        public int exp { get; private set; }
        public int level { get; private set; }
        public TreasureState state { get; set; }
 
        public List<TreasureStage> treasureStages = new List<TreasureStage>();
 
        public Treasure(int id)
        {
            this.id = id;
        }
 
        public int skillId
        {
            get
            {
                var job = PlayerDatas.Instance.baseData.Job;
                var stage = treasureStages.Find((x) =>
                {
                    return x.unlockType == TreasureStageUnlock.Skill;
                });
                return stage != null ? stage.GetSkill(job) : 0;
            }
        }
 
        public void RefreshLevel(int level, int exp)
        {
            this.level = level;
            this.exp = exp;
        }
 
        public void ParseStage(TreasureUpConfig config)
        {
            treasureStages.Add(new TreasureStage(config));
        }
    }
 
    public struct VIPKillNPCTreasure
    {
        public int level;
        public long currentExp;
    }
 
    public class TreasureStage
    {
        public int stage { get; set; }
        public TreasureStageUnlock unlockType { get; private set; }
        public Dictionary<int, int> propertyDict { get; private set; }
        public Dictionary<int, int> skillDict { get; private set; }
        public int func { get; private set; }
        public int exp { get; set; }
        public int powerEx { get; set; }
 
        public TreasureStage(TreasureUpConfig config)
        {
            unlockType = TreasureStageUnlock.None;
            if (config.UnLockFuncID != 0)
            {
                unlockType = TreasureStageUnlock.Func;
                func = config.UnLockFuncID;
            }
            else if (config.UnLockSkill != null && config.UnLockSkill.Length > 1)
            {
                unlockType = TreasureStageUnlock.Skill;
                skillDict = new Dictionary<int, int>();
                for (int i = 0; i < config.UnLockSkill.Length; i++)
                {
                    skillDict.Add(i + 1, config.UnLockSkill[i]);
                }
            }
            else if (!string.IsNullOrEmpty(config.AddAttr))
            {
                unlockType = TreasureStageUnlock.Property;
                propertyDict = ConfigParse.GetDic<int, int>(config.AddAttr);
            }
 
            exp = config.NeedExp;
            stage = config.LV;
            powerEx = config.PowerEx;
        }
 
        public int GetSkill(int _job)
        {
            if (skillDict.ContainsKey(_job))
            {
                return skillDict[_job];
            }
            return 0;
        }
 
        public int GetFightPower()
        {
            switch (unlockType)
            {
                case TreasureStageUnlock.Property:
                    return UIHelper.GetFightPower(propertyDict);
                case TreasureStageUnlock.Skill:
                    var job = PlayerDatas.Instance.baseData.Job;
                    var _skillCfg = SkillConfig.Get(GetSkill(job));
                    if (_skillCfg != null)
                    {
                        return _skillCfg.FightPower;
                    }
                    break;
            }
            return 0;
        }
    }
 
    public class TreasureDungeon
    {
        public int treasureId;
        public List<TreasureDungeonInfo> dungeonInfos = new List<TreasureDungeonInfo>();
        private int m_Level = 0;
 
        public int currentLevel
        {
            get
            {
                var model = ModelCenter.Instance.GetModel<TreasureModel>();
                Treasure treasure;
                if (model.TryGetTreasure(treasureId, out treasure)
                    && treasure.state == TreasureState.Collected)
                {
                    return maxLevel;
                }
                return m_Level;
            }
            set
            {
                m_Level = value;
            }
        }
 
        public int maxLevel { get; private set; }
 
        public Redpoint challengeRedpoint;
 
        public TreasureDungeon(int treasureId,Redpoint challengeRedpoint)
        {
            this.treasureId = treasureId;
            this.challengeRedpoint = challengeRedpoint;
        }
 
        public void ParseDungeonInfo(TreasureDungeonConfig config)
        {
            if (dungeonInfos.FindIndex((x) =>
             {
                 return x.level == config.Level;
             }) == -1)
            {
                var json = LitJson.JsonMapper.ToObject(config.Attr);
                var propertyDict = new Dictionary<int, int>();
                foreach (var key in json.Keys)
                {
                    var property = int.Parse(key);
                    var value = int.Parse(json[key].ToString());
                    propertyDict.Add(property, value);
                }
                var dungeonInfo = new TreasureDungeonInfo()
                {
                    key = config.ID,
                    fightPower = config.fightPower,
                    level = config.Level,
                    propertyDict = propertyDict,
                    lineId = config.LineID,
                    defense = config.defense,
                };
                dungeonInfos.Add(dungeonInfo);
 
                if (config.Level > maxLevel)
                {
                    maxLevel = config.Level;
                }
            }
        }
 
        public TreasureDungeonInfo Get(int level)
        {
            return dungeonInfos.Find((x) =>
            {
                return x.level == level;
            });
        }
 
        public Dictionary<int, int> GetUpperProperty(int level)
        {
            var lastDungeonInfo = Get(level - 1);
            var currentDungeonInfo = Get(level);
            if (currentDungeonInfo.Equals(default(TreasureDungeonInfo)))
            {
                return null;
            }
            var dict = new Dictionary<int, int>();
            foreach (var key in currentDungeonInfo.propertyDict.Keys)
            {
                if (level == 1)
                {
                    dict.Add(key, currentDungeonInfo.propertyDict[key]);
                }
                else
                {
                    if (lastDungeonInfo.propertyDict.ContainsKey(key))
                    {
                        if (lastDungeonInfo.propertyDict[key] >= currentDungeonInfo.propertyDict[key])
                        {
                            continue;
                        }
                        dict.Add(key, currentDungeonInfo.propertyDict[key] - lastDungeonInfo.propertyDict[key]);
                    }
                    else
                    {
                        dict.Add(key, currentDungeonInfo.propertyDict[key]);
                    }
                }
            }
            return dict;
        }
    }
 
    public struct TreasureDungeonInfo
    {
        public int key;
        public int lineId;
        public int level;
        public Dictionary<int, int> propertyDict;
        public int fightPower;
        public int defense;
    }
 
    public enum TreasureStageUnlock
    {
        None,
        Property,
        Skill,
        Func,
    }
}