提交 | 用户 | age
|
652343
|
1 |
//-------------------------------------------------------- |
CX |
2 |
// [Author]: 第二世界 |
|
3 |
// [ Date ]: Tuesday, July 16, 2019 |
|
4 |
//-------------------------------------------------------- |
|
5 |
|
|
6 |
using System; |
|
7 |
using System.Collections; |
|
8 |
using System.Collections.Generic; |
|
9 |
using UnityEngine; |
|
10 |
using UnityEngine.UI; |
|
11 |
|
4465b6
|
12 |
namespace vnxbqy.UI |
652343
|
13 |
{ |
CX |
14 |
|
|
15 |
public class EquipStarEffectTipWin : Window |
|
16 |
{ |
|
17 |
[SerializeField] ScrollRect m_ScrollRect; |
|
18 |
|
|
19 |
[SerializeField] RectTransform m_SuitContainer; |
|
20 |
[SerializeField] SuitBehaviour[] m_SuitBehaviours; |
b849ed
|
21 |
[SerializeField] RectTransform m_TrainContainer; |
652343
|
22 |
|
CX |
23 |
[SerializeField] Text m_StarProperty; |
|
24 |
[SerializeField] Text m_GemHole; |
|
25 |
[SerializeField] Text m_StengthLimit; |
|
26 |
[SerializeField] Text m_TrainLimit; |
|
27 |
|
|
28 |
EquipStarEffectTipModel model { get { return ModelCenter.Instance.GetModel<EquipStarEffectTipModel>(); } } |
b849ed
|
29 |
EquipTrainModel equipTrainModel { get { return ModelCenter.Instance.GetModel<EquipTrainModel>(); } } |
652343
|
30 |
|
CX |
31 |
#region Built-in |
|
32 |
protected override void BindController() |
|
33 |
{ |
|
34 |
} |
|
35 |
|
|
36 |
protected override void AddListeners() |
|
37 |
{ |
|
38 |
} |
|
39 |
|
|
40 |
protected override void OnPreOpen() |
|
41 |
{ |
|
42 |
} |
|
43 |
|
|
44 |
protected override void OnAfterOpen() |
|
45 |
{ |
|
46 |
} |
|
47 |
|
|
48 |
protected override void OnPreClose() |
|
49 |
{ |
|
50 |
} |
|
51 |
|
|
52 |
protected override void OnAfterClose() |
|
53 |
{ |
|
54 |
} |
|
55 |
|
|
56 |
protected override void OnActived() |
|
57 |
{ |
|
58 |
base.OnActived(); |
|
59 |
|
|
60 |
DisplaySuit(); |
|
61 |
DisplayStarProperty(); |
|
62 |
DisplayGemHole(); |
|
63 |
DisplayStrengthLimit(); |
|
64 |
DisplayTrainLimit(); |
|
65 |
|
ec78db
|
66 |
m_ScrollRect.verticalNormalizedPosition = 1f; |
652343
|
67 |
} |
CX |
68 |
#endregion |
|
69 |
|
|
70 |
private void DisplaySuit() |
|
71 |
{ |
|
72 |
if (model.equipPosition.y >= 1 && model.equipPosition.y <= 8) |
|
73 |
{ |
f23c81
|
74 |
m_SuitContainer.SetActive(true); |
652343
|
75 |
var effectInfos = model.GetSuitEffectInfos(model.equipPosition); |
6d4c04
|
76 |
foreach (var item in m_SuitBehaviours) |
CX |
77 |
{ |
|
78 |
item.Hide(); |
|
79 |
} |
|
80 |
|
652343
|
81 |
foreach (var item in effectInfos) |
CX |
82 |
{ |
ec78db
|
83 |
m_SuitBehaviours[item.Key / 3].Display(item.Key, item.Value); |
652343
|
84 |
} |
CX |
85 |
} |
|
86 |
else |
|
87 |
{ |
f23c81
|
88 |
m_SuitContainer.SetActive(false); |
652343
|
89 |
} |
CX |
90 |
} |
|
91 |
|
|
92 |
private void DisplayStarProperty() |
|
93 |
{ |
|
94 |
var effectInfos = model.GetStarProperties(model.equipPosition); |
|
95 |
var descriptions = new string[effectInfos.Count]; |
|
96 |
for (var i = 0; i < descriptions.Length; i++) |
|
97 |
{ |
|
98 |
var info = effectInfos[i]; |
|
99 |
var property = PlayerPropertyConfig.GetFullDescription(info.property.x, info.property.y); |
dee74a
|
100 |
descriptions[i] = Language.Get("EquipStar5", |
3ed42e
|
101 |
EquipStarEffectTipModel.GetStarNumberCHS(info.star), |
CX |
102 |
property); |
|
103 |
|
652343
|
104 |
descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
ec78db
|
105 |
: UIHelper.AppendColor(TextColType.White, descriptions[i], true); |
652343
|
106 |
} |
CX |
107 |
|
|
108 |
m_StarProperty.text = string.Join("\n", descriptions); |
|
109 |
} |
|
110 |
|
|
111 |
private void DisplayGemHole() |
|
112 |
{ |
|
113 |
var effectInfos = model.GetGemHoleInfos(model.equipPosition); |
|
114 |
var descriptions = new string[effectInfos.Count]; |
|
115 |
for (var i = 0; i < descriptions.Length; i++) |
|
116 |
{ |
|
117 |
var info = effectInfos[i]; |
dee74a
|
118 |
descriptions[i] = Language.Get("EquipStar6", |
3ed42e
|
119 |
EquipStarEffectTipModel.GetStarNumberCHS(info.star), |
CX |
120 |
EquipStarEffectTipModel.GetStarNumberCHS(info.index)); |
|
121 |
|
652343
|
122 |
descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
ec78db
|
123 |
: UIHelper.AppendColor(TextColType.White, descriptions[i], true); |
652343
|
124 |
} |
CX |
125 |
|
9ece3e
|
126 |
m_GemHole.text = string.Join("\n", descriptions); |
652343
|
127 |
} |
CX |
128 |
|
|
129 |
private void DisplayStrengthLimit() |
|
130 |
{ |
|
131 |
var effectInfos = model.GetStrengthLevelInfos(model.equipPosition); |
|
132 |
var descriptions = new string[effectInfos.Count]; |
|
133 |
for (var i = 0; i < descriptions.Length; i++) |
|
134 |
{ |
|
135 |
var info = effectInfos[i]; |
dee74a
|
136 |
descriptions[i] = Language.Get("EquipStar7", |
3ed42e
|
137 |
EquipStarEffectTipModel.GetStarNumberCHS(info.star), info.level); |
CX |
138 |
|
652343
|
139 |
descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
ec78db
|
140 |
: UIHelper.AppendColor(TextColType.White, descriptions[i], true); |
652343
|
141 |
} |
CX |
142 |
|
9ece3e
|
143 |
m_StengthLimit.text = string.Join("\n", descriptions); |
652343
|
144 |
} |
CX |
145 |
|
|
146 |
private void DisplayTrainLimit() |
|
147 |
{ |
b849ed
|
148 |
if (model.equipPosition.x < equipTrainModel.limitLevel) |
H |
149 |
{ |
f23c81
|
150 |
m_TrainContainer.SetActive(false); |
b849ed
|
151 |
return; |
H |
152 |
} |
f23c81
|
153 |
m_TrainContainer.SetActive(true); |
b849ed
|
154 |
|
3ed42e
|
155 |
var effectInfos = model.GetTrainLevelInfos(model.equipPosition); |
CX |
156 |
var descriptions = new string[effectInfos.Count]; |
|
157 |
for (var i = 0; i < descriptions.Length; i++) |
652343
|
158 |
{ |
3ed42e
|
159 |
var info = effectInfos[i]; |
dee74a
|
160 |
descriptions[i] = Language.Get("EquipStar7", |
3ed42e
|
161 |
EquipStarEffectTipModel.GetStarNumberCHS(info.star), info.level); |
CX |
162 |
|
|
163 |
descriptions[i] = info.actived ? UIHelper.AppendColor(TextColType.Green, descriptions[i]) |
ec78db
|
164 |
: UIHelper.AppendColor(TextColType.White, descriptions[i], true); |
652343
|
165 |
} |
3ed42e
|
166 |
|
CX |
167 |
m_TrainLimit.text = string.Join("\n", descriptions); |
652343
|
168 |
} |
CX |
169 |
|
|
170 |
[System.Serializable] |
|
171 |
public class SuitBehaviour |
|
172 |
{ |
|
173 |
public RectTransform container; |
|
174 |
public Text title; |
|
175 |
public Text content; |
|
176 |
|
ec78db
|
177 |
public void Display(int star, List<EquipStarEffectTipModel.SuitEffectInfo> effectInfos) |
652343
|
178 |
{ |
f23c81
|
179 |
container.SetActive(true); |
ec78db
|
180 |
var actived = false; |
CX |
181 |
var lines = new List<string>(); |
|
182 |
foreach (var effectInfo in effectInfos) |
|
183 |
{ |
|
184 |
switch (effectInfo.suitType) |
|
185 |
{ |
|
186 |
case EquipSuitType.TwoSuit: |
|
187 |
for (int i = 0; i < effectInfo.properties.Count; i++) |
|
188 |
{ |
|
189 |
var property = effectInfo.properties[i]; |
dee74a
|
190 |
lines.Add(Language.Get("EquipStar8", PlayerPropertyConfig.GetFullDescription(property.x, property.y))); |
ec78db
|
191 |
lines[lines.Count - 1] = effectInfo.actived ? UIHelper.AppendColor(TextColType.Green, lines[lines.Count - 1]) |
CX |
192 |
: UIHelper.AppendColor(TextColType.White, lines[lines.Count - 1], true); |
|
193 |
} |
|
194 |
break; |
|
195 |
case EquipSuitType.FiveSuit: |
|
196 |
for (int i = 0; i < effectInfo.properties.Count; i++) |
|
197 |
{ |
|
198 |
var property = effectInfo.properties[i]; |
dee74a
|
199 |
lines.Add(Language.Get("EquipStar9", PlayerPropertyConfig.GetFullDescription(property.x, property.y))); |
ec78db
|
200 |
lines[lines.Count - 1] = effectInfo.actived ? UIHelper.AppendColor(TextColType.Green, lines[lines.Count - 1]) |
CX |
201 |
: UIHelper.AppendColor(TextColType.White, lines[lines.Count - 1], true); |
|
202 |
} |
|
203 |
break; |
|
204 |
case EquipSuitType.EightSuit: |
|
205 |
for (int i = 0; i < effectInfo.properties.Count; i++) |
|
206 |
{ |
|
207 |
var property = effectInfo.properties[i]; |
dee74a
|
208 |
lines.Add(Language.Get("EquipStar10", PlayerPropertyConfig.GetFullDescription(property.x, property.y))); |
ec78db
|
209 |
lines[lines.Count - 1] = effectInfo.actived ? UIHelper.AppendColor(TextColType.Green, lines[lines.Count - 1]) |
CX |
210 |
: UIHelper.AppendColor(TextColType.White, lines[lines.Count - 1], true); |
|
211 |
} |
652343
|
212 |
|
ec78db
|
213 |
if (effectInfo.skillId > 0) |
CX |
214 |
{ |
dee74a
|
215 |
lines.Add(Language.Get("EquipStar10", effectInfo.skillDescription)); |
ec78db
|
216 |
lines[lines.Count - 1] = effectInfo.actived ? UIHelper.AppendColor(TextColType.Green, lines[lines.Count - 1]) |
CX |
217 |
: UIHelper.AppendColor(TextColType.White, lines[lines.Count - 1], true); |
|
218 |
} |
|
219 |
break; |
|
220 |
} |
|
221 |
|
|
222 |
if (effectInfo.actived) |
|
223 |
{ |
|
224 |
actived = true; |
|
225 |
} |
|
226 |
} |
|
227 |
|
|
228 |
content.text = string.Join("\n", lines.ToArray()); |
|
229 |
|
dee74a
|
230 |
var titleDescription = Language.Get("EquipStar11", EquipStarEffectTipModel.GetStarNumberCHS(star)); |
ec78db
|
231 |
title.text = actived ? UIHelper.AppendColor(TextColType.Green, titleDescription) |
CX |
232 |
: UIHelper.AppendColor(TextColType.White, titleDescription, true); |
652343
|
233 |
} |
CX |
234 |
|
6d4c04
|
235 |
public void Hide() |
CX |
236 |
{ |
f23c81
|
237 |
container.SetActive(false); |
6d4c04
|
238 |
} |
652343
|
239 |
} |
CX |
240 |
|
|
241 |
} |
|
242 |
|
|
243 |
} |
|
244 |
|
|
245 |
|
|
246 |
|
|
247 |
|