DressUpFightView.cs 25 KB

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