提交 | 用户 | age
|
463e5e
|
1 |
using DG.Tweening;
|
L |
2 |
using System.Collections.Generic;
|
|
3 |
using System.Linq;
|
|
4 |
using UnityEngine;
|
|
5 |
using UnityEngine.UI;
|
|
6 |
|
|
7 |
namespace vnxbqy.UI
|
|
8 |
{
|
|
9 |
public class YunShiXBActWin : Window
|
|
10 |
{
|
|
11 |
[SerializeField] List<Transform> startItems;//所有气泡起始坐标
|
|
12 |
[SerializeField] Transform transStartQianTong;//签筒起始坐标
|
|
13 |
[SerializeField] List<Transform> transStartQian;//所有签子起始坐标
|
|
14 |
|
|
15 |
[SerializeField] List<YunShiXBItem> yunShiXBItems;//所有气泡
|
|
16 |
[SerializeField] Transform transQianTong;//ǩͲ
|
|
17 |
[SerializeField] List<Transform> transQian;//所有签子
|
|
18 |
|
|
19 |
[SerializeField] Transform oneEnd;//单抽气泡目的地坐标
|
|
20 |
[SerializeField] List<Transform> manyEnds;//多抽气泡目的地坐标
|
|
21 |
|
|
22 |
[SerializeField] Transform transItemMissEnd;//所有气泡消失点目的地坐标
|
|
23 |
[SerializeField] Transform transQianTongMissEnd;//签筒目的地坐标
|
|
24 |
|
|
25 |
[SerializeField] List<PositionTween> qianPositionTweens = new List<PositionTween>();
|
|
26 |
[SerializeField] RotationTween qianTongRotationTween;
|
|
27 |
[SerializeField] UIEffect qianTongUIEffect;
|
|
28 |
[SerializeField] List<UIEffect> haveUIEffects;
|
|
29 |
|
|
30 |
[SerializeField] TextEx actTime;
|
|
31 |
[SerializeField] ButtonEx btnXBOne;
|
|
32 |
[SerializeField] ButtonEx btnXBMany;
|
|
33 |
[SerializeField] ButtonEx btnRate;
|
|
34 |
[SerializeField] TextEx txtXBOne;
|
|
35 |
[SerializeField] TextEx txtXBMany;
|
|
36 |
[SerializeField] TextEx txtXBOneCount;
|
|
37 |
[SerializeField] TextEx txtXBManyCount;
|
|
38 |
[SerializeField] ButtonEx btnSkip;
|
|
39 |
[SerializeField] ImageEx imgSkip;
|
|
40 |
|
|
41 |
[SerializeField] TextEx txtHasCnt;
|
|
42 |
[SerializeField] List<Slider> sliders = new List<Slider>();
|
|
43 |
[SerializeField] List<ItemCell> itemCells = new List<ItemCell>();
|
|
44 |
[SerializeField] List<ImageEx> imgGreys = new List<ImageEx>();
|
|
45 |
[SerializeField] List<ImageEx> imgHaves = new List<ImageEx>();
|
|
46 |
[SerializeField] List<TextEx> needCnts = new List<TextEx>();
|
|
47 |
[SerializeField] List<RotationTween> awardRotationTweens = new List<RotationTween>();
|
|
48 |
|
|
49 |
int type;
|
|
50 |
HappyXBModel happyXBModel { get { return ModelCenter.Instance.GetModelEx<HappyXBModel>(); } }
|
|
51 |
YunShiXBActModel model { get { return ModelCenter.Instance.GetModelEx<YunShiXBActModel>(); } }
|
|
52 |
PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
|
|
53 |
|
|
54 |
protected override void AddListeners()
|
|
55 |
{
|
|
56 |
btnSkip.SetListener(() =>
|
|
57 |
{
|
|
58 |
model.isSkipXB = !model.isSkipXB;
|
|
59 |
RefreshSkipUI();
|
|
60 |
});
|
|
61 |
|
|
62 |
btnRate.SetListener(() =>
|
|
63 |
{
|
|
64 |
WindowCenter.Instance.Open<YunShiXBProbabilityWin>();
|
|
65 |
});
|
|
66 |
|
|
67 |
btnXBOne.SetListener(() =>
|
|
68 |
{
|
|
69 |
if (!happyXBModel.IsHaveOneXBTool(type))
|
|
70 |
{
|
|
71 |
SysNotifyMgr.Instance.ShowTip("YunShiXBAct01");
|
|
72 |
return;
|
|
73 |
}
|
|
74 |
|
|
75 |
if (!model.isSkipXB)
|
|
76 |
{
|
|
77 |
MoveAndDisappear();
|
|
78 |
}
|
|
79 |
|
|
80 |
happyXBModel.SendXBQuest(type, 0, 2);
|
|
81 |
});
|
|
82 |
|
|
83 |
btnXBMany.SetListener(() =>
|
|
84 |
{
|
|
85 |
int toolCnt = 0;
|
|
86 |
int needToolCnt = 0;
|
|
87 |
if (!happyXBModel.IsHaveManyXBTool(type, out toolCnt, out needToolCnt) || toolCnt < needToolCnt)
|
|
88 |
{
|
|
89 |
SysNotifyMgr.Instance.ShowTip("YunShiXBAct01");
|
|
90 |
return;
|
|
91 |
}
|
|
92 |
|
|
93 |
if (!model.isSkipXB)
|
|
94 |
{
|
|
95 |
MoveAndDisappear();
|
|
96 |
}
|
|
97 |
happyXBModel.CheckXBManyLimit(0, type, 2);
|
|
98 |
});
|
|
99 |
}
|
|
100 |
|
|
101 |
protected override void BindController()
|
|
102 |
{
|
|
103 |
}
|
|
104 |
|
|
105 |
protected override void OnPreOpen()
|
|
106 |
{
|
|
107 |
WindowCenter.Instance.uiRoot.eventSystem.enabled = true;
|
8a2810
|
108 |
ItemLogicUtility.Instance.hidePickItem = true;
|
463e5e
|
109 |
happyXBModel.RefreshXBTypeInfoAct += OnRefreshXBTypeInfoAct;
|
L |
110 |
model.PlayAnimationSync += OnPlaySyncAnimation;
|
|
111 |
packModel.refreshItemCountEvent += OnRefreshItemCountEvent;
|
|
112 |
happyXBModel.RefreshXBResultAct += RefreshXBResult;
|
|
113 |
|
|
114 |
OperationYunShi act;
|
|
115 |
OperationTimeHepler.Instance.TryGetOperation(YunShiXBActModel.operaType, out act);
|
|
116 |
if (act == null)
|
|
117 |
return;
|
|
118 |
|
|
119 |
type = act.treasureType;
|
|
120 |
var xbInfo = happyXBModel.GetXBInfoByType(type);
|
|
121 |
if (xbInfo == null)
|
|
122 |
return;
|
|
123 |
|
|
124 |
if (type == 105)
|
|
125 |
{
|
|
126 |
happyXBModel.title = HappXBTitle.YunShi1;
|
|
127 |
}
|
|
128 |
else if (type == 106)
|
|
129 |
{
|
|
130 |
happyXBModel.title = HappXBTitle.YunShi2;
|
|
131 |
}
|
|
132 |
else if (type == 107)
|
|
133 |
{
|
|
134 |
happyXBModel.title = HappXBTitle.YunShi3;
|
|
135 |
}
|
|
136 |
else if (type == 108)
|
|
137 |
{
|
|
138 |
happyXBModel.title = HappXBTitle.YunShi4;
|
|
139 |
}
|
|
140 |
|
|
141 |
Display();
|
|
142 |
actTime.text = StringUtility.Contact(Language.Get("RidingPetBossQuestTime", act.ToDisplayTime()), Language.Get("YunShi04"));
|
|
143 |
}
|
|
144 |
|
|
145 |
protected override void OnPreClose()
|
|
146 |
{
|
8a2810
|
147 |
ItemLogicUtility.Instance.hidePickItem = false;
|
463e5e
|
148 |
happyXBModel.RefreshXBTypeInfoAct -= OnRefreshXBTypeInfoAct;
|
L |
149 |
model.PlayAnimationSync -= OnPlaySyncAnimation;
|
|
150 |
packModel.refreshItemCountEvent -= OnRefreshItemCountEvent;
|
|
151 |
happyXBModel.RefreshXBResultAct -= RefreshXBResult;
|
|
152 |
}
|
|
153 |
|
|
154 |
private void RefreshXBResult()
|
|
155 |
{
|
6d8908
|
156 |
Display();
|
463e5e
|
157 |
if (model.isSkipXB)
|
L |
158 |
{
|
|
159 |
ShowGetItem();
|
|
160 |
}
|
|
161 |
}
|
|
162 |
|
|
163 |
private void OnRefreshItemCountEvent(PackType type, int arg2, int arg3)
|
|
164 |
{
|
|
165 |
Display();
|
|
166 |
model.IsPlayAnimation = true;
|
|
167 |
}
|
|
168 |
|
|
169 |
private void OnRefreshXBTypeInfoAct()
|
|
170 |
{
|
|
171 |
Display();
|
|
172 |
model.IsPlayAnimation = true;
|
|
173 |
}
|
|
174 |
|
|
175 |
protected override void OnAfterOpen()
|
|
176 |
{
|
|
177 |
Reset();
|
|
178 |
for (int i = 0; i < awardRotationTweens.Count; i++)
|
|
179 |
{
|
|
180 |
awardRotationTweens[i].Stop();
|
|
181 |
awardRotationTweens[i].SetStartState();
|
|
182 |
}
|
|
183 |
var xbInfo = happyXBModel.GetXBInfoByType(type);
|
|
184 |
if (xbInfo == null)
|
|
185 |
return;
|
|
186 |
|
|
187 |
var award = TreasureCntAwardConfig.GetAwardIndexDict(type);
|
|
188 |
if (award == null)
|
|
189 |
return;
|
|
190 |
|
|
191 |
var list = award.Keys.ToList();
|
|
192 |
list.Sort();
|
|
193 |
if (list == null)
|
|
194 |
return;
|
|
195 |
|
|
196 |
for (int i = 0; i < model.AwardCellCount; i++)
|
|
197 |
{
|
|
198 |
if (i < list.Count)
|
|
199 |
{
|
|
200 |
int id = award[list[i]];
|
|
201 |
if (!TreasureCntAwardConfig.Has(id))
|
|
202 |
continue;
|
|
203 |
TreasureCntAwardConfig config = TreasureCntAwardConfig.Get(id);
|
|
204 |
int state = model.GetAwardState(xbInfo.treasureCount, config.NeedTreasureCnt, xbInfo.treasureCntAward, config.AwardIndex);
|
|
205 |
if (state == 1)
|
|
206 |
{
|
|
207 |
awardRotationTweens[i].Play();
|
|
208 |
}
|
|
209 |
}
|
|
210 |
else
|
|
211 |
{
|
|
212 |
awardRotationTweens[i].Stop();
|
|
213 |
awardRotationTweens[i].SetStartState();
|
|
214 |
}
|
|
215 |
}
|
|
216 |
}
|
|
217 |
|
|
218 |
protected override void OnAfterClose()
|
|
219 |
{
|
|
220 |
StopAllCoroutines();
|
|
221 |
}
|
|
222 |
|
|
223 |
private void OnPlaySyncAnimation()
|
|
224 |
{
|
|
225 |
for (int i = 0; i < awardRotationTweens.Count; i++)
|
|
226 |
{
|
|
227 |
awardRotationTweens[i].Stop();
|
|
228 |
awardRotationTweens[i].SetStartState();
|
|
229 |
}
|
|
230 |
var xbInfo = happyXBModel.GetXBInfoByType(type);
|
|
231 |
if (xbInfo == null)
|
|
232 |
return;
|
|
233 |
|
|
234 |
var award = TreasureCntAwardConfig.GetAwardIndexDict(type);
|
|
235 |
if (award == null)
|
|
236 |
return;
|
|
237 |
|
|
238 |
var list = award.Keys.ToList();
|
|
239 |
list.Sort();
|
|
240 |
if (list == null)
|
|
241 |
return;
|
|
242 |
for (int i = 0; i < model.AwardCellCount; i++)
|
|
243 |
{
|
|
244 |
if (i < list.Count)
|
|
245 |
{
|
|
246 |
int id = award[list[i]];
|
|
247 |
if (!TreasureCntAwardConfig.Has(id))
|
|
248 |
continue;
|
|
249 |
TreasureCntAwardConfig config = TreasureCntAwardConfig.Get(id);
|
|
250 |
int state = model.GetAwardState(xbInfo.treasureCount, config.NeedTreasureCnt, xbInfo.treasureCntAward, config.AwardIndex);
|
|
251 |
if (awardRotationTweens[i].isActiveAndEnabled && state == 1)
|
|
252 |
{
|
|
253 |
awardRotationTweens[i].Play();
|
|
254 |
}
|
|
255 |
}
|
|
256 |
else
|
|
257 |
{
|
|
258 |
awardRotationTweens[i].Stop();
|
|
259 |
awardRotationTweens[i].SetStartState();
|
|
260 |
}
|
|
261 |
}
|
|
262 |
}
|
|
263 |
|
|
264 |
private void Reset()
|
|
265 |
{
|
|
266 |
qianTongUIEffect.Stop();
|
|
267 |
|
|
268 |
for (int i = 0; i < haveUIEffects.Count; i++)
|
|
269 |
{
|
|
270 |
haveUIEffects[i].Stop();
|
|
271 |
}
|
|
272 |
|
|
273 |
for (int i = 0; i < yunShiXBItems.Count; i++)
|
|
274 |
{
|
|
275 |
int gridIndex = i + 1;
|
|
276 |
yunShiXBItems[i].transform.position = startItems[i].position;
|
|
277 |
yunShiXBItems[i].SetActive(true);
|
|
278 |
yunShiXBItems[i].Display(gridIndex);
|
|
279 |
}
|
|
280 |
qianTongRotationTween.Stop();
|
|
281 |
|
|
282 |
for (int i = 0; i < qianPositionTweens.Count; i++)
|
|
283 |
{
|
|
284 |
qianPositionTweens[i].Stop();
|
|
285 |
}
|
|
286 |
|
|
287 |
transQianTong.transform.position = transStartQianTong.transform.position;
|
|
288 |
transQianTong.transform.rotation = transStartQianTong.transform.rotation;
|
|
289 |
|
|
290 |
for (int i = 0; i < transStartQian.Count; i++)
|
|
291 |
{
|
|
292 |
transQian[i].transform.position = transStartQian[i].transform.position;
|
|
293 |
transQian[i].transform.rotation = transStartQian[i].transform.rotation;
|
|
294 |
}
|
6d8908
|
295 |
Display();
|
463e5e
|
296 |
}
|
L |
297 |
|
|
298 |
public void MoveAndDisappear()
|
|
299 |
{
|
|
300 |
WindowCenter.Instance.uiRoot.eventSystem.enabled = false;
|
|
301 |
Sequence sequence = DOTween.Sequence();
|
|
302 |
foreach (YunShiXBItem item in yunShiXBItems)
|
|
303 |
{
|
9e9b35
|
304 |
sequence.Join(item.transform.DOMove(transItemMissEnd.position, 0.22f).SetEase(Ease.InOutSine).OnComplete(() => { item.SetActive(false); }));
|
463e5e
|
305 |
}
|
L |
306 |
sequence.Join(transQianTong.transform.DORotate(new Vector3(0, 0, -5), 0.3f).SetEase(Ease.InOutSine).OnComplete(() => { qianTongUIEffect.Play(); }));
|
|
307 |
sequence.Join(transQianTong.transform.DOMove(transQianTongMissEnd.position, 0.5f).SetEase(Ease.InOutSine));
|
|
308 |
sequence.OnComplete(() => { ShakeQianTong(); });
|
|
309 |
}
|
|
310 |
|
|
311 |
private void ShowGetItem()
|
|
312 |
{
|
5e0fb1
|
313 |
if (happyXBModel.title == HappXBTitle.YunShi1 || happyXBModel.title == HappXBTitle.YunShi2 || happyXBModel.title == HappXBTitle.YunShi3 || happyXBModel.title == HappXBTitle.YunShi4)
|
463e5e
|
314 |
{
|
5e0fb1
|
315 |
var xbItemlist = happyXBModel.rangelist;
|
L |
316 |
List<Item> itemList = new List<Item>();
|
9e9b35
|
317 |
|
5e0fb1
|
318 |
for (int i = 0; i < xbItemlist.Count; i++)
|
L |
319 |
{
|
|
320 |
XBGetItem xbItem = xbItemlist[i];
|
|
321 |
|
|
322 |
itemList.Add(new Item(xbItem.itemId, (ulong)xbItem.count));
|
|
323 |
}
|
15c37f
|
324 |
ItemLogicUtility.Instance.ShowGetItem(itemList, seconds: 0, func: () =>{ happyXBModel.rangelist.Clear(); });
|
5e0fb1
|
325 |
Reset();
|
L |
326 |
WindowCenter.Instance.uiRoot.eventSystem.enabled = true;
|
463e5e
|
327 |
}
|
L |
328 |
}
|
|
329 |
|
|
330 |
public void ShakeQianTong()
|
|
331 |
{
|
|
332 |
qianTongRotationTween.Play();
|
|
333 |
|
|
334 |
for (int i = 0; i < qianPositionTweens.Count; i++)
|
|
335 |
{
|
|
336 |
qianPositionTweens[i].duration = 0.3f;
|
|
337 |
qianPositionTweens[i].Play();
|
|
338 |
}
|
|
339 |
|
|
340 |
var xbItemlist = happyXBModel.rangelist;
|
|
341 |
if (xbItemlist.IsNullOrEmpty())
|
|
342 |
{
|
|
343 |
Reset();
|
|
344 |
WindowCenter.Instance.uiRoot.eventSystem.enabled = true;
|
|
345 |
return;
|
|
346 |
}
|
|
347 |
for (int i = 0; i < qianPositionTweens.Count; i++)
|
|
348 |
{
|
|
349 |
qianPositionTweens[i].duration = 0.3f;
|
|
350 |
}
|
|
351 |
Sequence moveSequence = DOTween.Sequence();
|
|
352 |
moveSequence.AppendInterval(1.5f);
|
|
353 |
|
|
354 |
if (xbItemlist.Count == 1)
|
|
355 |
{
|
|
356 |
YunShiXBItem item = yunShiXBItems[0];
|
|
357 |
yunShiXBItems[0].transform.position = haveUIEffects[0].transform.position;
|
|
358 |
Vector3 targetPosition = oneEnd.position;
|
|
359 |
XBGetItem xbItem = happyXBModel.rangelist[0];
|
|
360 |
DG.Tweening.Tween tween = item.transform.DOMove(targetPosition, 0.05f).SetDelay(0.05f).SetEase(Ease.InOutSine)
|
|
361 |
.OnStart(() =>
|
|
362 |
{
|
|
363 |
haveUIEffects[0].Play();
|
|
364 |
yunShiXBItems[0].Display(xbItem.itemId, xbItem.count);
|
|
365 |
yunShiXBItems[0].SetActive(true);
|
|
366 |
for (int i = 0; i < qianPositionTweens.Count; i++)
|
|
367 |
{
|
|
368 |
qianPositionTweens[i].duration = 0.1f;
|
|
369 |
}
|
|
370 |
});
|
|
371 |
moveSequence.Append(tween);
|
|
372 |
}
|
|
373 |
else
|
|
374 |
{
|
|
375 |
for (int i = 0; i < yunShiXBItems.Count; i++)
|
|
376 |
{
|
|
377 |
if (i < xbItemlist.Count)
|
|
378 |
{
|
|
379 |
int index = i;
|
|
380 |
YunShiXBItem item = yunShiXBItems[i];
|
|
381 |
yunShiXBItems[i].transform.position = haveUIEffects[i].transform.position;
|
|
382 |
Vector3 targetPosition = manyEnds[i].position;
|
|
383 |
XBGetItem xbItem = happyXBModel.rangelist[i];
|
|
384 |
DG.Tweening.Tween tween = item.transform.DOMove(targetPosition, 0.1f).SetDelay(0.1f).SetEase(Ease.InOutSine)
|
|
385 |
.OnStart(() =>
|
|
386 |
{
|
|
387 |
haveUIEffects[index].Play();
|
|
388 |
yunShiXBItems[index].Display(xbItem.itemId, xbItem.count);
|
|
389 |
yunShiXBItems[index].SetActive(true);
|
|
390 |
for (int i = 0; i < qianPositionTweens.Count; i++)
|
|
391 |
{
|
|
392 |
qianPositionTweens[i].duration = 0.1f;
|
|
393 |
}
|
|
394 |
});
|
|
395 |
moveSequence.Append(tween);
|
|
396 |
}
|
|
397 |
}
|
|
398 |
}
|
|
399 |
|
|
400 |
moveSequence.OnComplete(() =>
|
|
401 |
{
|
|
402 |
for (int i = 0; i < qianPositionTweens.Count; i++)
|
|
403 |
{
|
|
404 |
qianPositionTweens[i].duration = 0.3f;
|
|
405 |
}
|
|
406 |
Sequence sequence = DOTween.Sequence();
|
|
407 |
sequence.Join(transQianTong.transform.DORotate(new Vector3(0, 0, 0), 0.2f).SetEase(Ease.InOutSine));
|
|
408 |
sequence.Join(transQianTong.transform.DOMove(transStartQianTong.position, 0.2f).SetEase(Ease.InOutSine));
|
|
409 |
sequence.OnComplete(() =>
|
|
410 |
{
|
|
411 |
qianTongRotationTween.Stop();
|
|
412 |
for (int i = 0; i < qianPositionTweens.Count; i++)
|
|
413 |
{
|
|
414 |
qianPositionTweens[i].Stop();
|
|
415 |
qianPositionTweens[i].SetStartState();
|
|
416 |
}
|
|
417 |
Clock.AlarmAfter(0.5, ShowGetItem);
|
|
418 |
});
|
|
419 |
});
|
|
420 |
}
|
|
421 |
|
|
422 |
private void RefreshSkipUI()
|
|
423 |
{
|
|
424 |
imgSkip.SetActive(model.isSkipXB);
|
|
425 |
}
|
|
426 |
|
|
427 |
private void HaveAllAward()
|
|
428 |
{
|
|
429 |
var xbInfo = happyXBModel.GetXBInfoByType(type);
|
|
430 |
if (xbInfo == null)
|
|
431 |
return;
|
|
432 |
|
|
433 |
var award = TreasureCntAwardConfig.GetAwardIndexDict(type);
|
|
434 |
if (award == null)
|
|
435 |
return;
|
|
436 |
|
|
437 |
var list = award.Keys.ToList();
|
|
438 |
list.Sort();
|
|
439 |
if (list == null)
|
|
440 |
return;
|
|
441 |
for (int i = 0; i < model.AwardCellCount; i++)
|
|
442 |
{
|
|
443 |
if (i < list.Count)
|
|
444 |
{
|
|
445 |
int id = award[list[i]];
|
|
446 |
if (!TreasureCntAwardConfig.Has(id))
|
|
447 |
continue;
|
|
448 |
TreasureCntAwardConfig config = TreasureCntAwardConfig.Get(id);
|
|
449 |
int state = model.GetAwardState(xbInfo.treasureCount, config.NeedTreasureCnt, xbInfo.treasureCntAward, config.AwardIndex);
|
|
450 |
if (state == 1)
|
|
451 |
{
|
|
452 |
model.SendGetAward(type, config.NeedTreasureCnt);
|
|
453 |
}
|
|
454 |
}
|
|
455 |
}
|
|
456 |
}
|
|
457 |
|
|
458 |
private void Display()
|
|
459 |
{
|
|
460 |
var xbInfo = happyXBModel.GetXBInfoByType(type);
|
|
461 |
if (xbInfo == null)
|
|
462 |
return;
|
|
463 |
|
|
464 |
var award = TreasureCntAwardConfig.GetAwardIndexDict(type);
|
|
465 |
if (award == null)
|
|
466 |
return;
|
|
467 |
|
|
468 |
var list = award.Keys.ToList();
|
|
469 |
list.Sort();
|
|
470 |
if (list == null)
|
|
471 |
return;
|
|
472 |
|
|
473 |
var funcSet = happyXBModel.GetXBFuncSet(type);
|
|
474 |
if (funcSet == null)
|
|
475 |
return;
|
|
476 |
int toolCnt0 = packModel.GetItemCountByID(PackType.Item, funcSet.costToolIds[0]);
|
|
477 |
int toolCnt1 = packModel.GetItemCountByID(PackType.Item, funcSet.costToolIds[1]);
|
|
478 |
txtXBOneCount.text = StringUtility.Contact(toolCnt0, "/", funcSet.xbNums[0]);
|
|
479 |
txtXBManyCount.text = StringUtility.Contact(toolCnt1, "/", funcSet.xbNums[1]);
|
5e0fb1
|
480 |
txtXBOne.text = Language.Get("YunShi07", funcSet.xbNums[0]);
|
L |
481 |
txtXBMany.text = Language.Get("YunShi07", funcSet.xbNums[1]);
|
463e5e
|
482 |
RefreshSkipUI();
|
L |
483 |
txtHasCnt.text = xbInfo.treasureCount.ToString();
|
6d8908
|
484 |
|
L |
485 |
for (int i = 0; i < yunShiXBItems.Count; i++)
|
|
486 |
{
|
|
487 |
int gridIndex = i + 1;
|
|
488 |
yunShiXBItems[i].Display(gridIndex);
|
|
489 |
}
|
|
490 |
|
463e5e
|
491 |
for (int i = 0; i < model.AwardCellCount; i++)
|
L |
492 |
{
|
|
493 |
if (i < list.Count)
|
|
494 |
{
|
|
495 |
int id = award[list[i]];
|
|
496 |
if (!TreasureCntAwardConfig.Has(id))
|
|
497 |
continue;
|
|
498 |
TreasureCntAwardConfig config = TreasureCntAwardConfig.Get(id);
|
|
499 |
int state = model.GetAwardState(xbInfo.treasureCount, config.NeedTreasureCnt, xbInfo.treasureCntAward, config.AwardIndex);
|
|
500 |
int[][] awardItemArr = config.AwardItemList;
|
|
501 |
int itemID = awardItemArr[0][0];
|
|
502 |
int itemCount = awardItemArr[0][1];
|
|
503 |
ItemCellModel cellModel = new ItemCellModel(itemID, false, (ulong)itemCount);
|
|
504 |
itemCells[i].Init(cellModel);
|
|
505 |
itemCells[i].SetActive(true);
|
|
506 |
itemCells[i].button.SetListener(() =>
|
|
507 |
{
|
|
508 |
if (state == 1)
|
|
509 |
{
|
|
510 |
HaveAllAward();
|
|
511 |
}
|
|
512 |
else
|
|
513 |
{
|
|
514 |
ItemTipUtility.Show(itemID);
|
|
515 |
}
|
|
516 |
});
|
|
517 |
|
|
518 |
imgGreys[i].SetActive(state == 2);
|
|
519 |
imgHaves[i].SetActive(state == 2);
|
|
520 |
|
|
521 |
needCnts[i].SetActive(true);
|
|
522 |
needCnts[i].text = config.NeedTreasureCnt.ToString();
|
|
523 |
|
|
524 |
if (state != 0)
|
|
525 |
{
|
|
526 |
sliders[i].value = 1;
|
|
527 |
}
|
|
528 |
else
|
|
529 |
{
|
|
530 |
if (i == 0)
|
|
531 |
{
|
|
532 |
float value = Mathf.Floor((xbInfo.treasureCount / (float)config.NeedTreasureCnt) * 1000f) / 1000f;
|
|
533 |
sliders[i].value = value;
|
|
534 |
}
|
|
535 |
else
|
|
536 |
{
|
|
537 |
int lastId = award[list[i - 1]];
|
|
538 |
if (!TreasureCntAwardConfig.Has(lastId))
|
|
539 |
continue;
|
|
540 |
TreasureCntAwardConfig lastIdConfig = TreasureCntAwardConfig.Get(lastId);
|
|
541 |
float value = Mathf.Floor(((xbInfo.treasureCount - lastIdConfig.NeedTreasureCnt) / (float)(config.NeedTreasureCnt - lastIdConfig.NeedTreasureCnt)) * 1000f) / 1000f;
|
|
542 |
sliders[i].value = Mathf.Min(value, 1);
|
|
543 |
}
|
|
544 |
}
|
|
545 |
}
|
|
546 |
else
|
|
547 |
{
|
|
548 |
itemCells[i].SetActive(false);
|
|
549 |
needCnts[i].SetActive(false);
|
|
550 |
sliders[i].SetActive(false);
|
|
551 |
imgGreys[i].SetActive(false);
|
|
552 |
imgHaves[i].SetActive(false);
|
|
553 |
}
|
|
554 |
}
|
|
555 |
}
|
|
556 |
}
|
|
557 |
} |