DressUpFightView.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670
  1. using UI.DressUp;
  2. using FairyGUI;
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. namespace GFGGame
  6. {
  7. public class DressUpFightView : BaseView
  8. {
  9. private UI_DressUpFightUI _ui;
  10. private int _fightID;
  11. private string _levelID;
  12. private float listType1X = 0;
  13. private float partsListX = 0;
  14. private DressUpListType currentListType;
  15. private int[] _currentList2;
  16. private GameObject _scenePrefab;
  17. private GameObject _sceneObject;
  18. private List<int> _currentList3;
  19. private int _currentMenuType;
  20. private StoryLevelCfg _levelCfg;
  21. private StoryFightCfg _fightCfg;
  22. private const int SORT_BY_HIGH_SCORE = 0;
  23. private const int SORT_BY_LOW_SCORE = 1;
  24. private int _scoreIndex = SORT_BY_HIGH_SCORE;
  25. private bool _guideMenu;
  26. public override void Dispose()
  27. {
  28. if (_scenePrefab != null)
  29. {
  30. GameObject.Destroy(_scenePrefab);
  31. _scenePrefab = null;
  32. }
  33. UI_TypeItem.ClearProxy();
  34. UI_PartsListItem.ClearProxy();
  35. base.Dispose();
  36. }
  37. protected override void Init()
  38. {
  39. base.Init();
  40. packageName = UI_DressUpFightUI.PACKAGE_NAME;
  41. _ui = UI_DressUpFightUI.Create();
  42. viewCom = _ui.target;
  43. isfullScreen = true;
  44. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneDressUp"));
  45. _ui.m_btnClose.width = GRoot.inst.width;
  46. _ui.m_btnClose.height = GRoot.inst.height;
  47. _ui.m_btnClose.AddRelation(GRoot.inst, RelationType.Size);
  48. }
  49. protected override void OnInit()
  50. {
  51. base.OnInit();
  52. _ui.m_groupTaskHint.visible = false;
  53. _ui.m_btnRepeal.visible = false;
  54. _ui.m_btnRenewal.visible = false;
  55. _ui.m_btnSearch.visible = true;
  56. // _ui.m_comboBox.items = new string[] { "我的套装一", "我的套装二", "我的套装三", "我的套装四", "我的套装五", "我的套装六" };
  57. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高分优先", "低分优先" };
  58. InitLists();
  59. _ui.m_partsList.m_comboBoxRarity.onChanged.Add(OnComboBoxRarityChanged);
  60. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  61. _ui.m_btnHome.onClick.Add(OnClickBtnHome);
  62. // _ui.m_btnClothingShop.onClick.Add(OnClickBtnClothingShop);
  63. // _ui.m_comboBox.onChanged.Add(OnComboBoxChanged);
  64. _ui.m_comListType1.m_listType.onClickItem.Add(OnClickListType1Item);
  65. _ui.m_comListType2.m_listType.onClickItem.Add(OnClickListType2Item);
  66. _ui.m_partsList.m_list.onClickItem.Add(OnClickPartsListItem);
  67. _ui.m_touchPad.onClick.Add(OnTouchPad);
  68. _ui.m_btnHint.onClick.Add(OnClickBtnHint);
  69. _ui.m_btnClose.onClick.Add(OnClickBtnClose);
  70. _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
  71. _ui.m_btnNext.onClick.Add(OnClickBtnNext);
  72. _ui.m_btnRecommend.onClick.Add(OnClickBtnRecommend);
  73. _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
  74. _ui.m_compNeed.target.onClick.Add(OnClickComNeed);
  75. _ui.m_compNeed.m_listTag.itemRenderer = RenderListTagItem;
  76. // _ui.m_btnShow.onClick.Add(OnClickBtnShow);
  77. // _ui.m_btnHide.onClick.Add(OnClickBtnHide);
  78. // _ui.m_loaShow.onClick.Add(OnClickLoaShow);
  79. _ui.m_btnHide.visible = false;
  80. _ui.m_loaShow.visible = false;
  81. _ui.m_btnShow.visible = false;
  82. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
  83. EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, UpdatePartsListSort);
  84. // EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdatePartsListSort);
  85. EventAgent.AddEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
  86. }
  87. protected override void OnShown()
  88. {
  89. base.OnShown();
  90. StoryDataManager.usedRecommend = false;
  91. // _ui.m_comboBox.title = "我的套装";
  92. _ui.m_txtRecommendCount.SetVar("v1", "" + StoryDataManager.recommendCount).FlushVars();
  93. _ui.m_btnRecommend.enabled = StoryDataManager.recommendCount > 0;
  94. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  95. _levelID = (string)viewData;
  96. _levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  97. _fightCfg = StoryFightCfgArray.Instance.GetCfg(_levelCfg.fightID);
  98. if(!string.IsNullOrEmpty(_fightCfg.music))
  99. {
  100. MusicManager.Instance.Play(ResPathUtil.GetMusicPath(_fightCfg.music, "mp3"));
  101. }
  102. _ui.m_compNeed.target.visible = _fightCfg.needItemId > 0 || _fightCfg.needSuitId > 0 || _fightCfg.needTagsArr.Length > 0;
  103. if (_ui.m_compNeed.target.visible)
  104. {
  105. _ui.m_compNeed.m_c1.selectedIndex = 0;
  106. if (_fightCfg.needItemId > 0)
  107. {
  108. _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetItemName(_fightCfg.needItemId);
  109. _ui.m_compNeed.target.data = _fightCfg.needItemId;
  110. }
  111. else if (_fightCfg.needSuitId > 0)
  112. {
  113. _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetSuitName(_fightCfg.needSuitId);
  114. _ui.m_compNeed.target.data = _fightCfg.needSuitId;
  115. }
  116. else
  117. {
  118. _ui.m_compNeed.m_c1.selectedIndex = 1;
  119. _ui.m_compNeed.m_listTag.numItems = _fightCfg.needTagsArr.Length;
  120. }
  121. }
  122. StoryDataManager.currentScoreType = _fightCfg.scoreType;
  123. //一级菜单
  124. _ui.m_comListType1.m_listType.RemoveChildrenToPool();
  125. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 1;
  126. //_ui.m_comListType1.m_listType1.ResizeToFit(_ui.m_listType1.numItems);
  127. float maxHeight = _ui.target.height - _ui.m_comListType1.m_listType.y - DressUpView.BOTTOM_BLANK;
  128. if (_ui.m_comListType1.m_listType.height > maxHeight)
  129. {
  130. _ui.m_comListType1.m_listType.height = maxHeight;
  131. }
  132. _ui.m_comListType1.target.x = _ui.target.width;
  133. _ui.m_comListType2.target.x = _ui.target.width;
  134. _ui.m_partsList.target.x = _ui.target.width;
  135. _ui.m_scoreType.url = "ui://CommonGame/kp_sx_" + _fightCfg.scoreType;
  136. this.showListType1();
  137. if (_sceneObject == null)
  138. {
  139. _sceneObject = GameObject.Instantiate(_scenePrefab);
  140. EquipDataCache.cacher.setSceneObj(_sceneObject);
  141. EquipDataCache.cacher.PutOnDefaultSuitSaved();
  142. }
  143. UpdateScore();
  144. EventAgent.AddEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
  145. if (GuideDataManager.GetGuideCount(ConstGuideId.SINGLE_FIGHT_GUIDE) <= 0)
  146. {
  147. _guideMenu = GuideController.TryGuideDressUpFightViewMenuType0(_ui.m_comListType1.m_listType);
  148. }
  149. else if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0)
  150. {
  151. GuideController.TryGuideDressUpFightViewBtnRecommend(_ui.m_compNeed.target, _ui.m_comListType1.m_listType);
  152. }
  153. else if (GuideDataManager.GetGuideCount(ConstGuideId.SEE_DRESS_TIPS) <= 0)
  154. {
  155. GuideController.TryGuideDressUpFightViewBtnHint(_ui.m_btnHint);
  156. }
  157. }
  158. protected override void OnHide()
  159. {
  160. base.OnHide();
  161. GuideController.HideGuide();
  162. if (_sceneObject != null)
  163. {
  164. GameObject.Destroy(_sceneObject);
  165. _sceneObject = null;
  166. }
  167. EventAgent.RemoveEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
  168. _fightCfg = null;
  169. _levelCfg = null;
  170. }
  171. private void OnClickBtnBack()
  172. {
  173. this.Hide();
  174. // ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter);
  175. ViewManager.GoBackFrom(ViewName.STORY_CHAPTER_VIEW);
  176. }
  177. private void OnClickBtnHome()
  178. {
  179. GameController.GoBackToMainView();
  180. }
  181. private void OnClickBtnClothingShop()
  182. {
  183. ViewManager.Show(ViewName.CLOTHING_SHOP_VIEW, new object[] { null, _fightCfg.scoreType }, null, false, true);
  184. }
  185. private void OnClickListType1Item(EventContext context)
  186. {
  187. // GuideController.HideGuide();
  188. GObject typeItem = context.data as GObject;
  189. int order = (int)typeItem.data;
  190. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[order - 1];
  191. if (item1.subMenusArr.Length > 0)
  192. {
  193. this.showListType2(item1.subMenusArr);
  194. }
  195. else
  196. {
  197. this.showListParts(item1.type);
  198. if (GuideDataManager.GetGuideCount(ConstGuideId.SINGLE_FIGHT_GUIDE) <= 0)
  199. {
  200. GuideController.TryGuideDressUpFightViewMenuPart0(_ui.m_partsList.m_list, "找到这条裙子了,换上看看吧");
  201. }
  202. else if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0)
  203. {
  204. GuideController.TryGuideDressUpFightViewMenuPart1(_ui.m_partsList.m_list, "点击换上吧");
  205. }
  206. }
  207. this.hideListType1();
  208. }
  209. private void OnClickListType2Item(EventContext context)
  210. {
  211. GObject typeItem = context.data as GObject;
  212. int order = (int)typeItem.data;
  213. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[order - 1];
  214. this.showListParts(item2.type);
  215. this.hideListType2();
  216. }
  217. private void OnClickPartsListItem(EventContext context)
  218. {
  219. GObject listItem = context.data as GObject;
  220. int id = (int)listItem.data;
  221. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  222. {
  223. EquipDataCache.cacher.PutOnSuitCfg(id, false, true);
  224. }
  225. else
  226. {
  227. EquipDataCache.cacher.TryCancelSuit(id);
  228. EquipDataCache.cacher.AddOrRemove(id, true);
  229. UpdateListPartsSelected();
  230. GuideController.TryGuideDressUpFightViewBtnNext0(_ui.m_btnNext);
  231. }
  232. GuideController.TryCompleteGuide(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY);
  233. }
  234. private void OnTouchPad()
  235. {
  236. if (this.currentListType == DressUpListType.List3)
  237. {
  238. if (_currentList2 != null)
  239. {
  240. this.showListType2();
  241. }
  242. else
  243. {
  244. this.showListType1();
  245. }
  246. this.hideListParts();
  247. }
  248. else if (this.currentListType == DressUpListType.List2)
  249. {
  250. this.showListType1();
  251. this.hideListType2();
  252. }
  253. }
  254. private void OnClickBtnHint()
  255. {
  256. this.ShowTaskHint();
  257. GuideController.HideGuide();
  258. GuideController.TryCompleteGuide(ConstGuideId.SEE_DRESS_TIPS);
  259. }
  260. private void OnClickBtnDelete()
  261. {
  262. EquipDataCache.cacher.TakeOffAll();
  263. }
  264. private void OnClickBtnClose()
  265. {
  266. _ui.m_groupTaskHint.visible = false;
  267. }
  268. private void OnClickBtnNext()
  269. {
  270. if (EquipDataCache.cacher.score <= 0)
  271. {
  272. Alert.Show("只有换好衣服才能出门哦~")
  273. .SetRightButton(true, "好的");
  274. return;
  275. }
  276. if (CardDataManager.GetCardDicByRarity(0) != null)
  277. {
  278. ViewManager.Show<StoryCardChoose>(_fightCfg.scoreType);
  279. }
  280. else
  281. {
  282. StartCalculateScore();
  283. }
  284. }
  285. private void StartCalculateScore()
  286. {
  287. //不可移动代码位置
  288. bool hasFightTarget = _fightCfg.targetName != null && _fightCfg.targetName.Length > 0;
  289. this.Hide();
  290. if (hasFightTarget)
  291. {
  292. ViewManager.Show(ViewName.STORY_FIGHT_TARGET_VIEW);
  293. }
  294. else
  295. {
  296. ViewManager.Show(ViewName.STORY_FIGHT_SINGLE_VIEW);
  297. }
  298. }
  299. private void OnClickBtnRecommend()
  300. {
  301. StoryDataManager.usedRecommend = true;
  302. EquipDataCache.cacher.PutOnRecommendItems();
  303. }
  304. private void InitLists()
  305. {
  306. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  307. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  308. listType1X = _ui.m_comListType1.target.x;
  309. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width;
  310. //一级菜单
  311. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  312. }
  313. private void showListType1()
  314. {
  315. _currentList2 = null;
  316. currentListType = DressUpListType.List1;
  317. GTween.To(_ui.target.width, listType1X, 0.5f)
  318. .SetTarget(_ui.m_comListType1.target)
  319. .OnUpdate((GTweener t) =>
  320. {
  321. _ui.m_comListType1.target.x = t.value.x;
  322. });
  323. }
  324. private void hideListType1()
  325. {
  326. GTween.To(listType1X, _ui.target.width, 0.5f)
  327. .SetTarget(_ui.m_comListType1.target)
  328. .OnUpdate((GTweener t) =>
  329. {
  330. _ui.m_comListType1.target.x = t.value.x;
  331. });
  332. }
  333. private void showListType2(int[] menuStrArr = null)
  334. {
  335. currentListType = DressUpListType.List2;
  336. if (menuStrArr != null && menuStrArr.Length > 0)
  337. {
  338. int len = menuStrArr.Length;
  339. _currentList2 = menuStrArr.Clone() as int[];
  340. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  341. _ui.m_comListType2.m_listType.numItems = len;
  342. //_ui.m_listType2.ResizeToFit(_ui.m_listType2.numItems);
  343. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  344. if (_ui.m_comListType2.m_listType.height > maxHeight)
  345. {
  346. _ui.m_comListType2.m_listType.height = maxHeight;
  347. }
  348. }
  349. GTween.To(_ui.target.width, listType1X, 0.5f)
  350. .SetTarget(_ui.m_comListType2.target)
  351. .OnUpdate((GTweener t) =>
  352. {
  353. _ui.m_comListType2.target.x = t.value.x;
  354. });
  355. }
  356. private void hideListType2()
  357. {
  358. GTween.To(listType1X, _ui.target.width, 0.5f)
  359. .SetTarget(_ui.m_comListType2.target)
  360. .OnUpdate((GTweener t) =>
  361. {
  362. _ui.m_comListType2.target.x = t.value.x;
  363. });
  364. }
  365. private void showListParts(int type)
  366. {
  367. _currentMenuType = type;
  368. UpdatePartsListSort();
  369. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  370. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;
  371. if (_ui.m_partsList.m_list.height > maxHeight)
  372. {
  373. _ui.m_partsList.m_list.height = maxHeight;
  374. }
  375. currentListType = DressUpListType.List3;
  376. GTween.To(_ui.target.width, partsListX, 0.5f)
  377. .SetTarget(_ui.m_partsList)
  378. .OnUpdate((GTweener t) =>
  379. {
  380. _ui.m_partsList.target.x = t.value.x;
  381. });
  382. }
  383. private void OnComboBoxRarityChanged()
  384. {
  385. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  386. this.UpdatePartsListSort();
  387. }
  388. private void UpdatePartsListSort()
  389. {
  390. if (_currentMenuType == 0) return;
  391. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  392. {
  393. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  394. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  395. {
  396. _currentList3 = SuitUtil.SortSuitListByHighScore(_currentList3);
  397. }
  398. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  399. {
  400. _currentList3 = SuitUtil.SortSuitListByLowScore(_currentList3);
  401. }
  402. else
  403. {
  404. _currentList3.Reverse();
  405. }
  406. }
  407. else
  408. {
  409. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  410. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  411. {
  412. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3);
  413. }
  414. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  415. {
  416. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3);
  417. }
  418. else
  419. {
  420. _currentList3.Reverse();
  421. }
  422. }
  423. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  424. {
  425. _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3, _currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG);
  426. }
  427. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  428. {
  429. _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3, _currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG);
  430. }
  431. //必穿品放在列表最前面
  432. if (_fightCfg.needItemId > 0)
  433. {
  434. int index = _currentList3.IndexOf(_fightCfg.needItemId);
  435. if (index >= 0)
  436. {
  437. int item = _currentList3[index];
  438. _currentList3.Remove(_currentList3[index]);
  439. _currentList3.Insert(0, item);
  440. }
  441. }
  442. else if (_fightCfg.needSuitId > 0)
  443. {
  444. int index = _currentList3.IndexOf(_fightCfg.needSuitId);
  445. if (index >= 0)
  446. {
  447. int item = _currentList3[index];
  448. _currentList3.Remove(_currentList3[index]);
  449. _currentList3.Insert(0, item);
  450. }
  451. }
  452. _ui.m_partsList.m_list.RemoveChildrenToPool();
  453. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  454. }
  455. private void hideListParts()
  456. {
  457. GTween.To(partsListX, _ui.target.width, 0.5f)
  458. .SetTarget(_ui.m_partsList)
  459. .OnUpdate((GTweener t) =>
  460. {
  461. _ui.m_partsList.target.x = t.value.x;
  462. });
  463. }
  464. private void ListType1Item(int index, GObject item)
  465. {
  466. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  467. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
  468. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
  469. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  470. typeItem.target.data = item1.id;
  471. typeItem.m_imgNeed.visible = ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, item1.id);
  472. }
  473. private void ListType2Item(int index, GObject item)
  474. {
  475. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  476. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
  477. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
  478. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  479. typeItem.target.data = item2.id;
  480. var subType = ItemUtil.GetItemSubType(_fightCfg.needItemId);
  481. typeItem.m_imgNeed.visible = subType == item2.type;
  482. }
  483. private void ListPartsItem(int index, GObject item)
  484. {
  485. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  486. int id = (int)_currentList3[index];
  487. string iconRes = "";
  488. string partName = "";
  489. string ext = "png";
  490. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  491. {
  492. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  493. iconRes = suitCfg.res;
  494. partName = suitCfg.name;
  495. listItem.m_iconSelected.visible = false;
  496. listItem.m_txtScore.text = "" + SuitUtil.GetSuitScore(id);
  497. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  498. }
  499. else
  500. {
  501. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  502. iconRes = itemCfg.res;
  503. partName = itemCfg.name;
  504. listItem.m_iconSelected.visible = EquipDataCache.cacher.CheckDressUpItemIsOn(id);
  505. listItem.m_txtScore.text = "" + DressUpMenuItemDataManager.GetItemScore(id);
  506. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  507. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType);
  508. }
  509. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  510. listItem.m_ScoreType.url = "ui://CommonGame/kp_sx_" + _fightCfg.scoreType;
  511. listItem.m_txtTitle.text = partName;
  512. listItem.target.data = id;
  513. listItem.m_imgNeed.visible = _fightCfg.needItemId == id || _fightCfg.needSuitId == id;
  514. }
  515. private void UpdateListPartsSelected()
  516. {
  517. int count = _ui.m_partsList.m_list.numChildren;
  518. for (int i = 0; i < count; i++)
  519. {
  520. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(i));
  521. int id = (int)listItem.target.data;
  522. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  523. {
  524. listItem.m_iconSelected.visible = false;
  525. }
  526. else
  527. {
  528. listItem.m_iconSelected.visible = EquipDataCache.cacher.CheckDressUpItemIsOn(id);
  529. }
  530. }
  531. }
  532. private void ShowTaskHint()
  533. {
  534. _ui.m_groupTaskHint.visible = true;
  535. _ui.m_txtHint.text = _levelCfg.hint;
  536. if (this._ui.m_txtHint.textHeight > this._ui.m_txtHint.textFormat.size * 2)
  537. {
  538. this._ui.m_txtHint.align = AlignType.Left;
  539. }
  540. else
  541. {
  542. this._ui.m_txtHint.align = AlignType.Center;
  543. }
  544. }
  545. private void UpdateScore()
  546. {
  547. _ui.m_txtScore.text = "" + EquipDataCache.cacher.score;
  548. // GuideController.TryGuideDressUpFightViewBtnNext(_ui.m_btnNext);
  549. }
  550. private void OnClickBtnSearch()
  551. {
  552. ViewManager.Show<DressFilterView>(false, new object[] { ViewName.DRESS_UP_VIEW });
  553. }
  554. // private void OnClickBtnShow()
  555. // {
  556. // Timers.inst.Remove(SetBtnShowVisable);
  557. // _ui.m_c1.selectedIndex = 0;
  558. // _ui.m_btnHide.visible = true;
  559. // _ui.m_loaShow.visible = false;
  560. // _ui.m_btnShow.visible = false;
  561. // }
  562. // private void OnClickBtnHide()
  563. // {
  564. // _ui.m_c1.selectedIndex = 1;
  565. // _ui.m_btnHide.visible = false;
  566. // _ui.m_btnShow.visible = true;
  567. // _ui.m_loaShow.visible = true;
  568. // Timers.inst.Add(2f, 1, SetBtnShowVisable);
  569. // }
  570. // private void OnClickLoaShow()
  571. // {
  572. // Timers.inst.Remove(SetBtnShowVisable);
  573. // _ui.m_btnShow.alpha = 1;
  574. // Timers.inst.Add(2f, 1, SetBtnShowVisable);
  575. // _ui.m_btnShow.enabled = true;
  576. // }
  577. private void SetBtnShowVisable(object param)
  578. {
  579. _ui.m_btnShow.enabled = false;
  580. GTween.To(1, 0, 0.3f).SetTarget(_ui.m_btnShow, TweenPropType.Alpha);
  581. }
  582. private void OnClickComNeed()
  583. {
  584. GuideController.HideGuide();
  585. if (_fightCfg.needItemId <= 0 && _fightCfg.needSuitId <= 0)
  586. {
  587. return;
  588. }
  589. if (_fightCfg.needSuitId > 0)
  590. {
  591. ViewManager.Show(ViewName.SUIT_GUIDE_VIEW, new object[] { _ui.m_compNeed.target.data, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData } }, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData });
  592. }
  593. else
  594. {
  595. ViewManager.Show(ViewName.APPROACH_OF_ITEM_VIEW, new object[] { _ui.m_compNeed.target.data, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData } });
  596. }
  597. }
  598. private void RenderListTagItem(int index, GObject obj)
  599. {
  600. UI.CommonGame.UI_ListTagItem item = UI.CommonGame.UI_ListTagItem.Proxy(obj);
  601. string[] tag = _fightCfg.needTagsArr[index].Split('_');
  602. item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tag[0]);
  603. item.m_txtTag.text = tag[1];
  604. }
  605. }
  606. }