LuckyBoxBonusShowView.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856
  1. using FairyGUI;
  2. using UI.LuckyBox;
  3. using System.Collections.Generic;
  4. using System.Collections;
  5. using cfg.GfgCfg;
  6. using ET;
  7. using System;
  8. using UnityEngine;
  9. namespace GFGGame
  10. {
  11. public class LuckyBoxBonusShowView : BaseWindow
  12. {
  13. private UI_LuckBoxBonusShowUI _ui;
  14. private List<ItemData> _rewardList = new List<ItemData>();
  15. private List<ItemData> _rewardItemList = new List<ItemData>();
  16. private Dictionary<int, Dictionary<int, EffectUI>> _effListTen =
  17. new Dictionary<int, Dictionary<int, EffectUI>>();
  18. private Dictionary<int, EffectUI> _effList = new Dictionary<int, EffectUI>();
  19. private Dictionary<int, bool> _itemHasNew = new Dictionary<int, bool>();
  20. private Dictionary<int, int> _itemIdList = new Dictionary<int, int>();
  21. private Dictionary<int, GComponent> _itemObjList = new Dictionary<int, GComponent>();
  22. private List<int> _recordOpenIndex = new List<int>(); //记录打开过得item位置
  23. private List<int> _recordTurnIndex = new List<int>(); //记录播放过item位置
  24. private int _chooseIndex = -1; //当前选中的index
  25. private int _countShow = 0; //第几次展示
  26. private bool _handClick = false; //手动点击开启
  27. private bool _AnimationWait = true; //抽卡动画等待加载完毕
  28. bool _touchLoaBg = true; //防止点击背景事件太快
  29. private EffectUI _effectUI1;
  30. private EffectUI _effectUI2;
  31. private EffectUI _effectUI3;
  32. private Dictionary<string, EffectUI> _effectUIDic = new Dictionary<string, EffectUI>();
  33. private bool _allEffectsLoaded = false;
  34. private int _loadingEffectCount = 0;
  35. public override void Dispose()
  36. {
  37. try
  38. {
  39. EffectUIPool.Recycle(_effectUI1);
  40. _effectUI1 = null;
  41. EffectUIPool.Recycle(_effectUI2);
  42. _effectUI2 = null;
  43. EffectUIPool.Recycle(_effectUI3);
  44. _effectUI3 = null;
  45. ClearAllEffects();
  46. if (_ui != null)
  47. {
  48. _ui.Dispose();
  49. _ui = null;
  50. }
  51. base.Dispose();
  52. }
  53. catch (Exception e)
  54. {
  55. Debug.LogError(e);
  56. }
  57. }
  58. private void ClearAllEffects()
  59. {
  60. try
  61. {
  62. for (int key = 0; key < _effListTen.Count; key++)
  63. {
  64. if (_effListTen.ContainsKey(key))
  65. {
  66. for (int key1 = 0; key1 < _effListTen[key].Count; key1++)
  67. {
  68. if (_effListTen[key].ContainsKey(key1))
  69. {
  70. EffectUIPool.Recycle(_effListTen[key][key1]);
  71. _effListTen[key][key1] = null;
  72. }
  73. }
  74. }
  75. }
  76. _effListTen.Clear();
  77. for (int key = 0; key < _effList.Count; key++)
  78. {
  79. if (_effList.ContainsKey(key))
  80. {
  81. EffectUIPool.Recycle(_effList[key]);
  82. _effList[key] = null;
  83. }
  84. }
  85. _effList.Clear();
  86. foreach (var v in _effectUIDic)
  87. {
  88. EffectUIPool.Recycle(v.Value);
  89. }
  90. _effectUIDic.Clear();
  91. }
  92. catch (Exception e)
  93. {
  94. Debug.LogError(e);
  95. }
  96. }
  97. protected override void OnInit()
  98. {
  99. try
  100. {
  101. base.OnInit();
  102. packageName = UI_LuckBoxBonusShowUI.PACKAGE_NAME;
  103. _ui = UI_LuckBoxBonusShowUI.Create();
  104. this.viewCom = _ui.target;
  105. isfullScreen = true;
  106. _ui.m_loaBg.onClick.Add(OnClickLoaBg);
  107. _ui.m_BtnPass.onClick.Add(OnClickBtnPass);
  108. }
  109. catch (Exception e)
  110. {
  111. Debug.LogError(e);
  112. }
  113. }
  114. protected override void AddEventListener()
  115. {
  116. try
  117. {
  118. base.AddEventListener();
  119. EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_REWARD_SHOW, ReferNextShow);
  120. EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_ANIMATION_WAIT, SetAnimationWait);
  121. EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_SHOW_VIEW_CLOSE, OthershowViewClose);
  122. }
  123. catch (Exception e)
  124. {
  125. Debug.LogError(e);
  126. }
  127. }
  128. protected override void RemoveEventListener()
  129. {
  130. try
  131. {
  132. base.RemoveEventListener();
  133. EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_REWARD_SHOW, ReferNextShow);
  134. EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_ANIMATION_WAIT, SetAnimationWait);
  135. EventAgent.RemoveEventListener(ConstMessage.LUCKY_BOX_SHOW_VIEW_CLOSE, OthershowViewClose);
  136. }
  137. catch (Exception e)
  138. {
  139. Debug.LogError(e);
  140. }
  141. }
  142. protected override void OnShown()
  143. {
  144. try
  145. {
  146. base.OnShown();
  147. _allEffectsLoaded = false;
  148. _touchLoaBg = false;
  149. _rewardList.Clear();
  150. _rewardList.AddRange(this.viewData as List<ItemData>);
  151. _itemIdList.Clear();
  152. _itemObjList.Clear();
  153. _recordOpenIndex.Clear();
  154. _recordTurnIndex.Clear();
  155. _itemHasNew.Clear();
  156. _ui.m_BtnPass.visible = false;
  157. _ui.m_touchFlipOpen.touchable = false;
  158. _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("zx_bg");
  159. // 异步加载所有特效
  160. Timers.inst.StartCoroutine(LoadAllEffects(() =>
  161. {
  162. _allEffectsLoaded = true;
  163. SetupViewAfterEffectsLoaded();
  164. }));
  165. }
  166. catch (Exception e)
  167. {
  168. Debug.LogError(e);
  169. }
  170. }
  171. private IEnumerator LoadAllEffects(Action onComplete)
  172. {
  173. // 加载背景特效
  174. _effectUI1 = EffectUIPool.CreateEffectUI(_ui.m_holder_star, "ui_LuckyBox", "bg_liuxing");
  175. _effectUI2 = EffectUIPool.CreateEffectUI(_ui.m_holder_bg, "ui_LuckyBox", "CK_UI");
  176. _effectUI3 = EffectUIPool.CreateEffectUI(_ui.m_holder_cloud, "ui_LuckyBox", "bg_cloud");
  177. // 等待所有背景特效加载完成
  178. while (_effectUI1.GetObj() == null || _effectUI2.GetObj() == null ||
  179. _effectUI3.GetObj() == null)
  180. {
  181. yield return null;
  182. }
  183. onComplete?.Invoke();
  184. }
  185. private void SetupViewAfterEffectsLoaded()
  186. {
  187. try
  188. {
  189. if (!_allEffectsLoaded) return;
  190. if (_rewardList.Count == 1)
  191. {
  192. _ui.m_c1.selectedIndex = 0;
  193. UpdateItem(_ui.m_itemOne.target, 0, 1);
  194. }
  195. else
  196. {
  197. _ui.m_c1.selectedIndex = 1;
  198. for (int i = 0; i < _rewardList.Count; i++)
  199. {
  200. UpdateItem(_ui.target.GetChild("item" + i).asCom, i, 10);
  201. }
  202. }
  203. // 修改,因为加了抽奖动画,在进入后就直接筛选掉所有不是新的
  204. for (int i = 0; i < _rewardList.Count; i++)
  205. {
  206. UI_LuckyBoxBonusShowItem item = UI_LuckyBoxBonusShowItem.Proxy(_itemObjList[i]);
  207. if (!item.m_comIcon.m_imgNew.visible)
  208. {
  209. _recordTurnIndex.Add(i);
  210. _recordOpenIndex.Add(i);
  211. }
  212. UI_LuckyBoxBonusShowItem.ProxyEnd();
  213. }
  214. if (GetSuitItemController.isAuto)
  215. {
  216. OnClickBtnPass();
  217. }
  218. Timers.inst.Add(0.5f, 1, UpDataTimeTouchLoaBg);
  219. }
  220. catch (Exception e)
  221. {
  222. Debug.LogError(e);
  223. }
  224. }
  225. protected override void OnHide()
  226. {
  227. try
  228. {
  229. _rewardList.Clear();
  230. base.OnHide();
  231. Timers.inst.Remove(UpDataTime);
  232. Timers.inst.Remove(UpClickDataTime);
  233. Timers.inst.Remove(touchFlipOpen);
  234. Timers.inst.Remove(UpDataTimeTouchLoaBg);
  235. GetSuitItemController.isAuto = false;
  236. _touchLoaBg = true;
  237. EventAgent.DispatchEvent(ConstMessage.LUCKY_BOX_BONUS_VIEW_CLOSE);
  238. }
  239. catch (Exception e)
  240. {
  241. Debug.LogError(e);
  242. }
  243. }
  244. private void UpdateItem(GComponent com, int index, int countType)
  245. {
  246. try
  247. {
  248. if (!_allEffectsLoaded) return;
  249. UI_LuckyBoxBonusShowItem item = UI_LuckyBoxBonusShowItem.Proxy(com);
  250. ItemData itemData = _rewardList[index];
  251. ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(itemData.id);
  252. item.m_comIcon.m_c1.selectedIndex = itemCfg.Rarity;
  253. item.m_comIcon.m_txtName.text = itemCfg.Name;
  254. item.m_comIcon.m_icon.url = ResPathUtil.GetIconPath(itemCfg);
  255. item.m_comIcon.m_FlipOpenType.selectedIndex = 0;
  256. item.m_comIcon.m_t1.Play();
  257. // 圆盘出现时等待玩家点击的特效
  258. switch (itemCfg.Rarity)
  259. {
  260. case 3:
  261. if (!_effectUIDic.ContainsKey("CK_Loop_Wait_Chen" + index))
  262. {
  263. _effectUIDic.Add("CK_Loop_Wait_Chen" + index,
  264. EffectUIPool.CreateEffectUI(item.m_waitClick_eff, "ui_LuckyBox", "CK_Loop_Wait_Chen"));
  265. }
  266. break;
  267. case 4:
  268. if (!_effectUIDic.ContainsKey("CK_Loop_Wait_GS" + index))
  269. {
  270. _effectUIDic.Add("CK_Loop_Wait_GS" + index,
  271. EffectUIPool.CreateEffectUI(item.m_waitClick_eff, "ui_LuckyBox", "CK_Loop_Wait_GS"));
  272. }
  273. break;
  274. case 5:
  275. if (!_effectUIDic.ContainsKey("CK_Loop_Wait_Jin" + index))
  276. {
  277. _effectUIDic.Add("CK_Loop_Wait_Jin" + index,
  278. EffectUIPool.CreateEffectUI(item.m_waitClick_eff, "ui_LuckyBox", "CK_Loop_Wait_Jin"));
  279. }
  280. break;
  281. }
  282. int count = 0;
  283. bool isFirst = false;
  284. for (int i = 0; i < _rewardList.Count; i++)
  285. {
  286. if (_rewardList[i].id == itemData.id) count++;
  287. if (count == 1 && i == index) isFirst = true;
  288. }
  289. item.m_comIcon.m_imgNew.visible = count == ItemDataManager.GetItemNum(itemData.id) && isFirst;
  290. if (_itemHasNew.ContainsKey(index))
  291. _itemHasNew[index] = item.m_comIcon.m_imgNew.visible;
  292. else
  293. _itemHasNew.Add(index, item.m_comIcon.m_imgNew.visible);
  294. item.m_t0.Play();
  295. if (item.target.data == null)
  296. {
  297. item.target.onClick.Add(ShowItemTips);
  298. }
  299. item.target.data = index;
  300. _itemIdList.Add(index, itemCfg.Id);
  301. _itemObjList.Add(index, com);
  302. UI_LuckyBoxBonusShowItem.ProxyEnd();
  303. }
  304. catch (Exception e)
  305. {
  306. Debug.LogError(e);
  307. }
  308. }
  309. private void ShowItemTips(EventContext context)
  310. {
  311. try
  312. {
  313. if (!_allEffectsLoaded || !_touchLoaBg) return;
  314. _touchLoaBg = false;
  315. Timers.inst.Add(0.5f, 1, UpDataTimeTouchLoaBg);
  316. GObject obj = context.sender as GObject;
  317. int index = (int)obj.data;
  318. _chooseIndex = index;
  319. GoodsItemTipsController.ShowItemTips(_itemIdList[index]);
  320. }
  321. catch (Exception e)
  322. {
  323. Debug.LogError(e);
  324. }
  325. }
  326. private void HandClickItem(int index)
  327. {
  328. try
  329. {
  330. if (!_allEffectsLoaded) return;
  331. _ui.m_touchFlipOpen.touchable = true;
  332. _handClick = true;
  333. ClickItem(index);
  334. //翻牌动画
  335. Timers.inst.Add(1f, 1, UpClickDataTime, index);
  336. }
  337. catch (Exception e)
  338. {
  339. Debug.LogError(e);
  340. }
  341. }
  342. private void UpClickDataTime(object param = null)
  343. {
  344. try
  345. {
  346. if (!_allEffectsLoaded) return;
  347. int index = (int)param;
  348. Timers.inst.Remove(UpClickDataTime);
  349. if (_recordTurnIndex.Contains(index) && _recordOpenIndex.Contains(index))
  350. {
  351. HideOtherShowWindow();
  352. _ui.m_touchFlipOpen.touchable = false;
  353. }
  354. else
  355. ClickItem(index);
  356. }
  357. catch (Exception e)
  358. {
  359. Debug.LogError(e);
  360. }
  361. }
  362. void ClickItem(int index)
  363. {
  364. try
  365. {
  366. if (!_allEffectsLoaded) return;
  367. if (_recordOpenIndex.Count >= _rewardList.Count)
  368. _ui.m_BtnPass.visible = false;
  369. if (!_recordOpenIndex.Contains(index))
  370. {
  371. TurnItem(index);
  372. }
  373. else
  374. {
  375. if (!_recordTurnIndex.Contains(index))
  376. ShowTurnItem(index);
  377. else
  378. GoodsItemTipsController.ShowItemTips(_itemIdList[index]);
  379. }
  380. }
  381. catch (Exception e)
  382. {
  383. Debug.LogError(e);
  384. }
  385. }
  386. private void UpDataTimeTouchLoaBg(object param = null)
  387. {
  388. try
  389. {
  390. _touchLoaBg = true;
  391. }
  392. catch (Exception e)
  393. {
  394. Debug.LogError(e);
  395. }
  396. }
  397. private void OnClickLoaBg(EventContext context)
  398. {
  399. try
  400. {
  401. if (!_allEffectsLoaded || !_touchLoaBg) return;
  402. _touchLoaBg = false;
  403. Timers.inst.Add(0.5f, 1, UpDataTimeTouchLoaBg);
  404. if (_recordOpenIndex.Count >= _rewardList.Count)
  405. {
  406. _chooseIndex = -1;
  407. this.Hide();
  408. }
  409. else
  410. {
  411. for (int index = 0; index < _rewardList.Count; index++)
  412. {
  413. if (!_recordOpenIndex.Contains(index))
  414. {
  415. _chooseIndex = index;
  416. HandClickItem(index);
  417. break;
  418. }
  419. }
  420. }
  421. }
  422. catch (Exception e)
  423. {
  424. Debug.LogError(e);
  425. }
  426. }
  427. private void OnClickBtnPass()
  428. {
  429. try
  430. {
  431. if (!_allEffectsLoaded) return;
  432. for (int index = 0; index < _rewardList.Count; index++)
  433. {
  434. if (!_recordOpenIndex.Contains(index))
  435. {
  436. int count = 0;
  437. bool isFirst = false;
  438. for (int i = 0; i < _rewardList.Count; i++)
  439. {
  440. if (_rewardList[i].id == _rewardList[index].id) count++;
  441. if (count == 1 && i == index) isFirst = true;
  442. }
  443. bool open = count == ItemDataManager.GetItemNum(_rewardList[index].id) && isFirst;
  444. if (!open)
  445. {
  446. _chooseIndex = -1;
  447. ClickItem(index);
  448. }
  449. }
  450. }
  451. ClickPass();
  452. }
  453. catch (Exception e)
  454. {
  455. Debug.LogError(e);
  456. }
  457. }
  458. private void ClickPass()
  459. {
  460. try
  461. {
  462. if (!_allEffectsLoaded) return;
  463. GetSuitItemController.isAuto = true;
  464. _ui.m_touchFlipOpen.touchable = true;
  465. _ui.m_BtnPass.visible = false;
  466. for (int i = 0; i < _rewardList.Count; i++)
  467. {
  468. TurnItem(i);
  469. }
  470. //展示获得物品
  471. Timers.inst.Add(LuckyBoxDataManager.ANIMATION_TIME, 0, UpDataTime);
  472. }
  473. catch (Exception e)
  474. {
  475. Debug.LogError(e);
  476. }
  477. }
  478. private void UpDataTime(object param = null)
  479. {
  480. try
  481. {
  482. if (!_allEffectsLoaded) return;
  483. _ui.m_touchFlipOpen.touchable = true;
  484. if (_recordTurnIndex.Count >= _rewardList.Count)
  485. {
  486. Timers.inst.Remove(UpDataTime);
  487. HideOtherShowWindow();
  488. _ui.m_touchFlipOpen.touchable = false;
  489. GetSuitItemController.isAuto = false;
  490. }
  491. for (int i = 0; i < _rewardList.Count; i++)
  492. {
  493. if (!_recordTurnIndex.Contains(i))
  494. {
  495. ShowTurnItem(i);
  496. break;
  497. }
  498. }
  499. }
  500. catch (Exception e)
  501. {
  502. Debug.LogError(e);
  503. }
  504. }
  505. private void ShowTurnItem(int index)
  506. {
  507. try
  508. {
  509. if (!_allEffectsLoaded || !_AnimationWait) return;
  510. UI_LuckyBoxBonusShowItem item = UI_LuckyBoxBonusShowItem.Proxy(_itemObjList[index]);
  511. if (!item.m_comIcon.m_imgNew.visible)
  512. {
  513. _recordTurnIndex.Add(index);
  514. _ui.m_touchFlipOpen.touchable = false;
  515. UI_LuckyBoxBonusShowItem.ProxyEnd();
  516. return;
  517. }
  518. _countShow += 1;
  519. //判断是否有套装需要展示
  520. int suitId = SuitCfgArray.Instance.GetSuitIdOfItem(_itemIdList[index]);
  521. ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(_itemIdList[index]);
  522. if (suitId > 0 && itemCfg.ItemType != ConstItemType.CARD)
  523. {
  524. if (_countShow == 1)
  525. {
  526. ViewManager.Hide<SuitItemView>();
  527. ViewManager.Hide<LuckyBoxNewCardView>();
  528. ViewManager.Hide<GetSuitItemVIew>();
  529. _rewardItemList.Clear();
  530. _rewardItemList.Add(_rewardList[index]);
  531. ViewManager.Show<LuckyBoxNewDressView>(_rewardItemList);
  532. }
  533. else
  534. {
  535. ViewManager.Hide<LuckyBoxNewDressView>();
  536. ViewManager.Hide<LuckyBoxNewCardView>();
  537. int count = 0;
  538. int totalCount = 0;
  539. DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitId, out count, out totalCount);
  540. if (_countShow == 2) //展示进度条界面
  541. {
  542. int countSuitId = 0;
  543. for (int i = index + 1; i < _rewardList.Count; i++)
  544. {
  545. _itemHasNew.TryGetValue(i, out bool isNew);
  546. var itemRewardCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(_rewardList[i].id);
  547. if (isNew && itemRewardCfg.ItemType == ConstItemType.DRESS_UP &&
  548. itemRewardCfg.SuitId == suitId)
  549. {
  550. countSuitId++;
  551. }
  552. }
  553. count = count - countSuitId;
  554. ViewManager.Show<SuitItemView>(new object[] { suitId, countSuitId });
  555. }
  556. else if (_countShow == 3) //展示集齐套装界面
  557. {
  558. ViewManager.Hide<SuitItemView>();
  559. ViewManager.Show<GetSuitItemVIew>(suitId);
  560. _AnimationWait = false;
  561. }
  562. //判断是否需要显示集齐套装界面(需要的时候晚3个定时器时间)
  563. if (count <= 0 || totalCount <= 0 || count < totalCount ||
  564. (count >= totalCount && _countShow > 5))
  565. {
  566. _recordTurnIndex.Add(index);
  567. _countShow = 0;
  568. if (_handClick)
  569. {
  570. _handClick = false;
  571. _ui.m_touchFlipOpen.touchable = false;
  572. }
  573. }
  574. }
  575. }
  576. else
  577. {
  578. //词牌和不是套装进这里
  579. ViewManager.Hide<SuitItemView>();
  580. ViewManager.Hide<LuckyBoxNewCardView>();
  581. ViewManager.Hide<GetSuitItemVIew>();
  582. _rewardItemList.Clear();
  583. _rewardItemList.Add(_rewardList[index]);
  584. ViewManager.Show<LuckyBoxNewDressView>(_rewardItemList);
  585. _recordTurnIndex.Add(index);
  586. _countShow = 0;
  587. Timers.inst.Add(1.5f, 1, touchFlipOpen); //防止点击太快
  588. }
  589. UI_LuckyBoxBonusShowItem.ProxyEnd();
  590. }
  591. catch (Exception e)
  592. {
  593. Debug.LogError(e);
  594. }
  595. }
  596. private void TurnItem(int index)
  597. {
  598. try
  599. {
  600. if (!_allEffectsLoaded || _recordOpenIndex.Contains(index)) return;
  601. // 删除 "等待翻开" 的特效
  602. if (_effectUIDic.ContainsKey("CK_Loop_Wait_Chen" + index))
  603. {
  604. EffectUIPool.Recycle(_effectUIDic["CK_Loop_Wait_Chen" + index]);
  605. _effectUIDic.Remove("CK_Loop_Wait_Chen" + index);
  606. }
  607. if (_effectUIDic.ContainsKey("CK_Loop_Wait_GS" + index))
  608. {
  609. EffectUIPool.Recycle(_effectUIDic["CK_Loop_Wait_GS" + index]);
  610. _effectUIDic.Remove("CK_Loop_Wait_GS" + index);
  611. }
  612. if (_effectUIDic.ContainsKey("CK_Loop_Wait_Jin" + index))
  613. {
  614. EffectUIPool.Recycle(_effectUIDic["CK_Loop_Wait_Jin" + index]);
  615. _effectUIDic.Remove("CK_Loop_Wait_Jin" + index);
  616. }
  617. UI_LuckyBoxBonusShowItem item = UI_LuckyBoxBonusShowItem.Proxy(_itemObjList[index]);
  618. if (!item.m_comIcon.m_imgNew.visible && !_recordTurnIndex.Contains(index))
  619. {
  620. _recordTurnIndex.Add(index);
  621. }
  622. ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(_itemIdList[index]);
  623. // 点击特效
  624. if (!_effectUIDic.ContainsKey("CK_Cirle_DJ" + index))
  625. {
  626. _effectUIDic.Add("CK_Cirle_DJ" + index,
  627. EffectUIPool.CreateEffectUI(item.m_comIcon.m_click_eff, "ui_LuckyBox", "CK_Cirle_DJ"));
  628. }
  629. else
  630. {
  631. _effectUIDic["CK_Cirle_DJ" + index] =
  632. EffectUIPool.CreateEffectUI(item.m_comIcon.m_click_eff, "ui_LuckyBox", "CK_Cirle_DJ");
  633. }
  634. // 翻开特效
  635. switch (itemCfg.Rarity)
  636. {
  637. case 1:
  638. _effectUIDic.Add("CK_OpenAfter_LanHui_UI" + index,
  639. EffectUIPool.CreateEffectUI(item.m_comIcon.m_ui_eff, "ui_LuckyBox",
  640. "CK_OpenAfter_HuiLan_UI"));
  641. _effectUIDic.Add("CK_OpenAfter_LanHui_TX" + index,
  642. EffectUIPool.CreateEffectUI(item.m_comIcon.m_flip_eff, "ui_LuckyBox",
  643. "CK_OpenAfter_LanHui_TX"));
  644. break;
  645. case 2:
  646. _effectUIDic.Add("CK_OpenAfter_LanHui_UI" + index,
  647. EffectUIPool.CreateEffectUI(item.m_comIcon.m_ui_eff, "ui_LuckyBox",
  648. "CK_OpenAfter_LanHui_UI"));
  649. _effectUIDic.Add("CK_OpenAfter_LanHui_TX" + index,
  650. EffectUIPool.CreateEffectUI(item.m_comIcon.m_flip_eff, "ui_LuckyBox",
  651. "CK_OpenAfter_LanHui_TX"));
  652. break;
  653. case 3:
  654. _effectUIDic.Add("CK_OpenAfter_Chen_UI" + index,
  655. EffectUIPool.CreateEffectUI(item.m_comIcon.m_ui_eff, "ui_LuckyBox",
  656. "CK_OpenAfter_Chen_UI"));
  657. _effectUIDic.Add("CK_OpenAfter_Chen_TX" + index,
  658. EffectUIPool.CreateEffectUI(item.m_comIcon.m_flip_eff, "ui_LuckyBox",
  659. "CK_OpenAfter_Chen_TX"));
  660. break;
  661. case 4:
  662. _effectUIDic.Add("CK_OpenAfter_GS_UI" + index,
  663. EffectUIPool.CreateEffectUI(item.m_comIcon.m_ui_eff, "ui_LuckyBox", "CK_OpenAfter_GS_UI"));
  664. _effectUIDic.Add("CK_OpenAfter_GS_TX" + index,
  665. EffectUIPool.CreateEffectUI(item.m_comIcon.m_flip_eff, "ui_LuckyBox",
  666. "CK_OpenAfter_GS_TX"));
  667. break;
  668. case 5:
  669. _effectUIDic.Add("CK_OpenAfter_Jin_UI" + index,
  670. EffectUIPool.CreateEffectUI(item.m_comIcon.m_ui_eff, "ui_LuckyBox", "CK_OpenAfter_Jin_UI"));
  671. _effectUIDic.Add("CK_OpenAfter_Jin_TX" + index,
  672. EffectUIPool.CreateEffectUI(item.m_comIcon.m_flip_eff, "ui_LuckyBox",
  673. "CK_OpenAfter_Jin_TX"));
  674. break;
  675. }
  676. _recordOpenIndex.Add(index);
  677. UI_LuckyBoxBonusShowItem.ProxyEnd();
  678. }
  679. catch (Exception e)
  680. {
  681. Debug.LogError(e);
  682. }
  683. }
  684. private void touchFlipOpen(object param)
  685. {
  686. try
  687. {
  688. Timers.inst.Remove(touchFlipOpen);
  689. _ui.m_touchFlipOpen.touchable = false;
  690. }
  691. catch (Exception e)
  692. {
  693. Debug.LogError(e);
  694. }
  695. }
  696. protected void OthershowViewClose()
  697. {
  698. try
  699. {
  700. _ui.m_touchFlipOpen.touchable = false;
  701. }
  702. catch (Exception e)
  703. {
  704. Debug.LogError(e);
  705. }
  706. }
  707. protected void ReferNextShow()
  708. {
  709. try
  710. {
  711. if (!_allEffectsLoaded || GetSuitItemController.isAuto) return;
  712. int suitId = 0;
  713. if (_itemIdList.ContainsKey(_chooseIndex))
  714. suitId = SuitCfgArray.Instance.GetSuitIdOfItem(_itemIdList[_chooseIndex]);
  715. if (_chooseIndex != -1 && suitId > 0)
  716. ClickItem(_chooseIndex);
  717. else
  718. {
  719. if (_handClick)
  720. {
  721. _handClick = false;
  722. _ui.m_touchFlipOpen.touchable = false;
  723. }
  724. }
  725. }
  726. catch (Exception e)
  727. {
  728. Debug.LogError(e);
  729. }
  730. }
  731. protected void SetAnimationWait()
  732. {
  733. try
  734. {
  735. _AnimationWait = true;
  736. }
  737. catch (Exception e)
  738. {
  739. Debug.LogError(e);
  740. }
  741. }
  742. private void HideOtherShowWindow()
  743. {
  744. try
  745. {
  746. ViewManager.Hide<SuitItemView>();
  747. ViewManager.Hide<GetSuitItemVIew>();
  748. ViewManager.Hide<LuckyBoxNewDressView>();
  749. ViewManager.Hide<LuckyBoxNewCardView>();
  750. }
  751. catch (Exception e)
  752. {
  753. Debug.LogError(e);
  754. }
  755. }
  756. }
  757. }