DressUpFightView.cs 25 KB

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