提交 | 用户 | age
|
652343
|
1 |
//-------------------------------------------------------- |
CX |
2 |
// [Author]: 第二世界 |
|
3 |
// [ Date ]: Tuesday, July 16, 2019 |
|
4 |
//-------------------------------------------------------- |
|
5 |
using UnityEngine; |
|
6 |
using System.Collections; |
|
7 |
using UnityEngine.UI; |
|
8 |
using System.Collections.Generic; |
|
9 |
|
4465b6
|
10 |
namespace vnxbqy.UI |
652343
|
11 |
{ |
CX |
12 |
|
|
13 |
public class EquipStarEffectTipModel : Model |
|
14 |
{ |
|
15 |
EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } } |
|
16 |
EquipStarModel starModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } } |
|
17 |
EquipStrengthModel strengthModel { get { return ModelCenter.Instance.GetModel<EquipStrengthModel>(); } } |
|
18 |
EquipTrainModel trainModel { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } } |
|
19 |
|
|
20 |
public Int2 equipPosition { get; private set; } |
|
21 |
|
|
22 |
public override void Init() |
|
23 |
{ |
|
24 |
} |
|
25 |
|
|
26 |
public override void UnInit() |
|
27 |
{ |
|
28 |
} |
|
29 |
|
|
30 |
public void Preview(Int2 equipPosition) |
|
31 |
{ |
|
32 |
this.equipPosition = equipPosition; |
|
33 |
WindowCenter.Instance.Open<EquipStarEffectTipWin>(); |
|
34 |
} |
|
35 |
|
|
36 |
public Dictionary<int, List<SuitEffectInfo>> GetSuitEffectInfos(Int2 equipPosition) |
|
37 |
{ |
|
38 |
var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
|
39 |
|
|
40 |
if (equipPosition.y >= 1 && equipPosition.y <= 8) |
|
41 |
{ |
3ed42e
|
42 |
var effectInfos = new Dictionary<int, List<SuitEffectInfo>>(); |
652343
|
43 |
var configs = EquipSuitConfig.GetConfigs(PlayerDatas.Instance.baseData.Job, equipPosition.x, EquipSuitType.EightSuit); |
CX |
44 |
|
d56e0c
|
45 |
for (int i = 0; i < 19; i += 3) |
652343
|
46 |
{ |
CX |
47 |
if (maxStarLevel >= i) |
|
48 |
{ |
6d4c04
|
49 |
effectInfos[i] = new List<SuitEffectInfo>(); |
652343
|
50 |
var twoSuit = equipModel.GetEquipSuitEntry(equipPosition.x, i, EquipSuitType.TwoSuit); |
CX |
51 |
var fiveSuit = equipModel.GetEquipSuitEntry(equipPosition.x, i, EquipSuitType.FiveSuit); |
|
52 |
var eightSuit = equipModel.GetEquipSuitEntry(equipPosition.x, i, EquipSuitType.EightSuit); |
|
53 |
|
|
54 |
effectInfos[i].Add(new SuitEffectInfo() |
|
55 |
{ |
|
56 |
suitType = EquipSuitType.TwoSuit, |
|
57 |
star = i, |
|
58 |
actived = twoSuit.actived, |
|
59 |
properties = twoSuit.properties |
|
60 |
}); |
|
61 |
|
|
62 |
effectInfos[i].Add(new SuitEffectInfo() |
|
63 |
{ |
|
64 |
suitType = EquipSuitType.FiveSuit, |
|
65 |
star = i, |
|
66 |
actived = fiveSuit.actived, |
|
67 |
properties = fiveSuit.properties |
|
68 |
}); |
|
69 |
|
|
70 |
var skillId = 0; |
ec78db
|
71 |
var skillDescription = string.Empty; |
652343
|
72 |
foreach (var config in configs) |
CX |
73 |
{ |
|
74 |
if (config.star == i) |
|
75 |
{ |
|
76 |
skillId = config.skillID; |
ec78db
|
77 |
skillDescription = config.description; |
652343
|
78 |
break; |
CX |
79 |
} |
|
80 |
} |
|
81 |
|
|
82 |
effectInfos[i].Add(new SuitEffectInfo() |
|
83 |
{ |
|
84 |
suitType = EquipSuitType.EightSuit, |
|
85 |
star = i, |
|
86 |
actived = eightSuit.actived, |
|
87 |
properties = eightSuit.properties, |
ec78db
|
88 |
skillId = skillId, |
CX |
89 |
skillDescription = skillDescription, |
652343
|
90 |
}); |
CX |
91 |
} |
|
92 |
} |
|
93 |
|
|
94 |
return effectInfos; |
|
95 |
} |
|
96 |
else |
|
97 |
{ |
|
98 |
return null; |
|
99 |
} |
|
100 |
} |
|
101 |
|
|
102 |
public List<StarProperty> GetStarProperties(Int2 equipPosition) |
|
103 |
{ |
|
104 |
var effectInfos = new List<StarProperty>(); |
|
105 |
|
|
106 |
var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
6d4c04
|
107 |
var starLevel = starModel.GetEquipStarLevel(equipPosition); |
652343
|
108 |
var configs = EquipStarConfig.GetConfigs(equipPosition.x, equipPosition.y); |
ec78db
|
109 |
var lastStarAttrCount = 0; |
69ad9e
|
110 |
if (configs == null) |
H |
111 |
return effectInfos; |
|
112 |
|
652343
|
113 |
for (var i = 0; i < configs.Count; i++) |
CX |
114 |
{ |
|
115 |
var config = configs[i]; |
ec78db
|
116 |
if (config.Star <= maxStarLevel && (lastStarAttrCount != config.StarAttrInfo.Length)) |
652343
|
117 |
{ |
CX |
118 |
effectInfos.Add(new StarProperty() |
|
119 |
{ |
|
120 |
star = config.Star, |
|
121 |
actived = starLevel >= config.Star, |
|
122 |
property = config.StarAttrInfo[config.StarAttrInfo.Length - 1] |
|
123 |
}); |
|
124 |
} |
ec78db
|
125 |
|
CX |
126 |
lastStarAttrCount = config.StarAttrInfo.Length; |
652343
|
127 |
} |
CX |
128 |
|
|
129 |
return effectInfos; |
|
130 |
} |
|
131 |
|
|
132 |
public List<GemHoleInfo> GetGemHoleInfos(Int2 equipPosition) |
|
133 |
{ |
|
134 |
var effectInfos = new List<GemHoleInfo>(); |
|
135 |
var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
6d4c04
|
136 |
var starLevel = starModel.GetEquipStarLevel(equipPosition); |
652343
|
137 |
if (maxStarLevel >= 0) |
CX |
138 |
{ |
|
139 |
effectInfos.Add(new GemHoleInfo() { star = 0, actived = starLevel >= 0, index = 1 }); |
|
140 |
} |
|
141 |
|
|
142 |
if (maxStarLevel >= 2) |
|
143 |
{ |
|
144 |
effectInfos.Add(new GemHoleInfo() { star = 2, actived = starLevel >= 2, index = 2 }); |
|
145 |
} |
|
146 |
|
|
147 |
if (maxStarLevel >= 5) |
|
148 |
{ |
|
149 |
effectInfos.Add(new GemHoleInfo() { star = 5, actived = starLevel >= 5, index = 3 }); |
|
150 |
} |
|
151 |
|
|
152 |
return effectInfos; |
|
153 |
} |
|
154 |
|
|
155 |
public List<StrengthLevelInfo> GetStrengthLevelInfos(Int2 equipPosition) |
|
156 |
{ |
|
157 |
var effectInfos = new List<StrengthLevelInfo>(); |
|
158 |
var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
6d4c04
|
159 |
var starLevel = starModel.GetEquipStarLevel(equipPosition); |
652343
|
160 |
var strengthType = EquipStrengthModel.GetEquipStrengthType(equipPosition.y); |
ec78db
|
161 |
var lastStarStrengthLevel = 0; |
652343
|
162 |
for (int i = 0; i <= maxStarLevel; i++) |
CX |
163 |
{ |
|
164 |
var levelLimit = strengthModel.GetEquipLevelMax(strengthType, i); |
ec78db
|
165 |
if (levelLimit != 0 && lastStarStrengthLevel != levelLimit) |
652343
|
166 |
{ |
CX |
167 |
effectInfos.Add(new StrengthLevelInfo() { star = i, actived = starLevel >= i, level = levelLimit }); |
|
168 |
} |
ec78db
|
169 |
|
CX |
170 |
lastStarStrengthLevel = levelLimit; |
652343
|
171 |
} |
CX |
172 |
|
|
173 |
return effectInfos; |
|
174 |
} |
|
175 |
|
|
176 |
public List<TrainLevelInfo> GetTrainLevelInfos(Int2 equipPosition) |
|
177 |
{ |
|
178 |
var effectInfos = new List<TrainLevelInfo>(); |
|
179 |
var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
6d4c04
|
180 |
var starLevel = starModel.GetEquipStarLevel(equipPosition); |
ec78db
|
181 |
var type = EquipTrainModel.GetTrainType(equipPosition.y); |
CX |
182 |
var lastStarTrainLevel = 0; |
652343
|
183 |
for (int i = 0; i <= maxStarLevel; i++) |
CX |
184 |
{ |
ec78db
|
185 |
var config = WashLevelMaxConfig.Get(type, i); |
CX |
186 |
var levelLimit = config.levelMax; |
|
187 |
if (levelLimit != lastStarTrainLevel) |
652343
|
188 |
{ |
CX |
189 |
effectInfos.Add(new TrainLevelInfo() { star = i, actived = starLevel >= i, level = levelLimit }); |
|
190 |
} |
ec78db
|
191 |
|
CX |
192 |
lastStarTrainLevel = levelLimit; |
652343
|
193 |
} |
CX |
194 |
|
|
195 |
return effectInfos; |
|
196 |
} |
|
197 |
|
fffbb5
|
198 |
public List<string> DisplayStarProperty(Int2 equipPosition) |
H |
199 |
{ |
|
200 |
var effectInfos = GetStarProperties(equipPosition); |
|
201 |
var descriptions = new List<string>(); |
|
202 |
for (var i = 0; i < effectInfos.Count; i++) |
|
203 |
{ |
|
204 |
var info = effectInfos[i]; |
|
205 |
var property = PlayerPropertyConfig.GetFullDescription(info.property.x, info.property.y); |
dee74a
|
206 |
var tmpString = Language.Get("EquipStar1", |
fffbb5
|
207 |
EquipStarEffectTipModel.GetStarNumberCHS(info.star), |
H |
208 |
property); |
|
209 |
|
|
210 |
descriptions.Add(info.actived ? UIHelper.AppendColor(TextColType.Green, tmpString, true) |
|
211 |
: UIHelper.AppendColor(TextColType.White, tmpString, true)); |
|
212 |
} |
|
213 |
return descriptions; |
|
214 |
|
|
215 |
} |
|
216 |
|
3ed42e
|
217 |
public List<string> GetNextTwoSpecialEffect(Int2 equipPosition) |
CX |
218 |
{ |
|
219 |
var specialEffects = new List<string>(); |
|
220 |
var maxStarLevel = EquipStarModel.GetMaxStarLevel(equipPosition.x); |
|
221 |
var starLevel = starModel.GetStarLevel(equipPosition); |
|
222 |
|
|
223 |
if (starLevel == maxStarLevel) |
|
224 |
{ |
|
225 |
var suitLevel = starLevel - starLevel % 3; |
dee74a
|
226 |
specialEffects.Add(Language.Get("EquipStar2", GetStarNumberCHS(starLevel), GetStarNumberCHS(suitLevel))); |
3ed42e
|
227 |
|
CX |
228 |
var equipStarConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel); |
|
229 |
var property = equipStarConfig.StarAttrInfo[equipStarConfig.StarAttrInfo.Length - 1]; |
dee74a
|
230 |
specialEffects.Add(Language.Get("EquipStar3", |
3ed42e
|
231 |
GetStarNumberCHS(starLevel), |
CX |
232 |
PlayerPropertyConfig.GetFullDescription(property.x, property.y) |
|
233 |
)); |
|
234 |
|
|
235 |
return specialEffects; |
|
236 |
} |
|
237 |
|
|
238 |
if (equipPosition.y >= 1 && equipPosition.y <= 8) |
|
239 |
{ |
|
240 |
if (starLevel % 3 == 2) |
|
241 |
{ |
|
242 |
var suitLevel = starLevel - starLevel % 3; |
dee74a
|
243 |
specialEffects.Add(Language.Get("EquipStar2", GetStarNumberCHS(starLevel + 1), GetStarNumberCHS(suitLevel))); |
3ed42e
|
244 |
} |
6d4c04
|
245 |
} |
3ed42e
|
246 |
|
6d4c04
|
247 |
var nowStarConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel); |
CX |
248 |
var nextStarConfig = EquipStarConfig.Get(equipPosition.x, equipPosition.y, starLevel + 1); |
|
249 |
if (nowStarConfig == null || nowStarConfig.StarAttrInfo.Length != nextStarConfig.StarAttrInfo.Length) |
|
250 |
{ |
|
251 |
var property = nextStarConfig.StarAttrInfo[nextStarConfig.StarAttrInfo.Length - 1]; |
dee74a
|
252 |
specialEffects.Add(Language.Get("EquipStar3", |
6d4c04
|
253 |
GetStarNumberCHS(starLevel + 1), |
CX |
254 |
PlayerPropertyConfig.GetFullDescription(property.x, property.y) |
|
255 |
)); |
|
256 |
} |
3ed42e
|
257 |
|
6d4c04
|
258 |
if (specialEffects.Count >= 2) |
CX |
259 |
{ |
|
260 |
return specialEffects; |
|
261 |
} |
3ed42e
|
262 |
|
1ef700
|
263 |
//var strengthType = EquipStrengthModel.GetEquipStrengthType(equipPosition.y); |
H |
264 |
//var nowStrengthLevel = strengthModel.GetEquipLevelMax(strengthType, starLevel); |
|
265 |
//var nextStrengthLevel = strengthModel.GetEquipLevelMax(strengthType, starLevel + 1); |
|
266 |
//if (nowStrengthLevel != nextStrengthLevel) |
|
267 |
//{ |
|
268 |
// specialEffects.Add(string.Format("【{0}星】{1}", |
|
269 |
// GetStarNumberCHS(starLevel + 1), |
|
270 |
// string.Format("强化等级提升至{0}", nextStrengthLevel) |
|
271 |
// )); |
|
272 |
//} |
3ed42e
|
273 |
|
1ef700
|
274 |
//if (specialEffects.Count >= 2) |
H |
275 |
//{ |
|
276 |
// return specialEffects; |
|
277 |
//} |
3ed42e
|
278 |
|
6d4c04
|
279 |
if (starLevel == 1 || starLevel == 4) |
CX |
280 |
{ |
dee74a
|
281 |
specialEffects.Add(Language.Get("EquipStar3", |
6d4c04
|
282 |
GetStarNumberCHS(starLevel + 1), |
dee74a
|
283 |
Language.Get("StarUpgradeSuccessTip3", GetStarNumberCHS(starLevel == 1 ? 1 : 2)) |
6d4c04
|
284 |
)); |
CX |
285 |
} |
3ed42e
|
286 |
|
6d4c04
|
287 |
if (specialEffects.Count >= 2) |
CX |
288 |
{ |
|
289 |
return specialEffects; |
|
290 |
} |
3ed42e
|
291 |
|
6d4c04
|
292 |
var type = EquipTrainModel.GetTrainType(equipPosition.y); |
CX |
293 |
var nowConfig = WashLevelMaxConfig.Get(type, starLevel); |
|
294 |
var nowTrainLevel = nowConfig.levelMax; |
|
295 |
var nextConfig = WashLevelMaxConfig.Get(type, starLevel + 1); |
|
296 |
var nextTrainLevel = nextConfig.levelMax; |
3ed42e
|
297 |
|
6d4c04
|
298 |
if (nowTrainLevel != nextTrainLevel) |
CX |
299 |
{ |
dee74a
|
300 |
specialEffects.Add(Language.Get("EquipStar3", |
6d4c04
|
301 |
GetStarNumberCHS(starLevel + 1), |
dee74a
|
302 |
Language.Get("EquipStar4", nextTrainLevel) |
6d4c04
|
303 |
)); |
3ed42e
|
304 |
} |
CX |
305 |
|
|
306 |
return specialEffects; |
|
307 |
} |
|
308 |
|
|
309 |
public static string GetStarNumberCHS(int star) |
d56e0c
|
310 |
{
|
H |
311 |
return Language.Get("Num_CHS_" + star); |
3ed42e
|
312 |
} |
CX |
313 |
|
652343
|
314 |
public struct SuitEffectInfo |
CX |
315 |
{ |
|
316 |
public int star; |
|
317 |
public bool actived; |
|
318 |
public EquipSuitType suitType; |
|
319 |
|
|
320 |
public List<Int2> properties; |
|
321 |
public int skillId; |
ec78db
|
322 |
public string skillDescription; |
652343
|
323 |
} |
CX |
324 |
|
|
325 |
public struct StarProperty |
|
326 |
{ |
|
327 |
public int star; |
|
328 |
public bool actived; |
|
329 |
public Int2 property; |
|
330 |
} |
|
331 |
|
|
332 |
public struct GemHoleInfo |
|
333 |
{ |
|
334 |
public int star; |
|
335 |
public bool actived; |
|
336 |
public int index; |
|
337 |
} |
|
338 |
|
|
339 |
public struct StrengthLevelInfo |
|
340 |
{ |
|
341 |
public int star; |
|
342 |
public bool actived; |
|
343 |
public int level; |
|
344 |
} |
|
345 |
|
|
346 |
public struct TrainLevelInfo |
|
347 |
{ |
|
348 |
public int star; |
|
349 |
public bool actived; |
|
350 |
public int level; |
|
351 |
} |
|
352 |
|
|
353 |
} |
|
354 |
|
|
355 |
} |
|
356 |
|
|
357 |
|
|
358 |
|