DressUpView.cs 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. using UI.DressUp;
  2. using FairyGUI;
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. namespace GFGGame
  6. {
  7. public class DressUpView : BaseView
  8. {
  9. public const int BOTTOM_BLANK = 20;
  10. public const int RIGHT_BLANK = 36;
  11. private const int SORT_BY_HIGH_RARITY = 0;
  12. private const int SORT_BY_LOW_RARITY = 1;
  13. private const int SORT_BY_GET_TIME = 2;
  14. private UI_DressUpUI _ui;
  15. private float listType1X = 0;
  16. private float partsListX = 0;
  17. private DressUpListType currentListType;
  18. /// <summary>
  19. /// 子菜单列表
  20. /// </summary>
  21. private int[] _currentList2;
  22. private GameObject _scenePrefab;
  23. private GameObject _sceneObject;
  24. private List<int> _currentList3;
  25. private List<int> _currentList4;
  26. private int _currentMenuType;
  27. private int _currentSuitId;
  28. private int _rarityIndex = SORT_BY_HIGH_RARITY;
  29. private UI_TypeItem listTypeItem_FreedomDress;
  30. public override void Dispose()
  31. {
  32. if (_scenePrefab != null)
  33. {
  34. GameObject.Destroy(_scenePrefab);
  35. _scenePrefab = null;
  36. }
  37. UI_TypeItem.ClearProxy();
  38. base.Dispose();
  39. }
  40. protected override void Init()
  41. {
  42. base.Init();
  43. packageName = UI_DressUpUI.PACKAGE_NAME;
  44. _ui = UI_DressUpUI.Create();
  45. viewCom = _ui.target;
  46. isfullScreen = true;
  47. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneDressUp"));
  48. }
  49. protected override void OnInit()
  50. {
  51. base.OnInit();
  52. _ui.m_btnLastStep.visible = false;
  53. _ui.m_btnNextStep.visible = false;
  54. _ui.m_btnSearch.visible = true;
  55. _ui.m_btnPhoto.visible = true;
  56. _ui.m_btnAction.visible = false;
  57. _ui.m_comboBox.items = new string[] { "我的套装一", "我的套装二", "我的套装三", "我的套装四", "我的套装五", "我的套装六" };
  58. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  59. InitLists();
  60. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  61. _ui.m_btnHome.onClick.Add(OnClickBtnHome);
  62. _ui.m_comboBox.onChanged.Add(OnComboBoxChanged);
  63. _ui.m_comListType1.m_listType.onClickItem.Add(OnClickListType1Item);
  64. _ui.m_comListType2.m_listType.onClickItem.Add(OnClickListType2Item);
  65. _ui.m_partsList.m_list.onClickItem.Add(OnClickPartsListItem);
  66. _ui.m_partsList2.m_list.onClickItem.Add(OnClickSuitPartsListItem);
  67. _ui.m_touchPad.onClick.Add(OnTouchPad);
  68. _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
  69. _ui.m_btnSave.onClick.Add(OnClickBtnSave);
  70. _ui.m_partsList.m_comboBoxRarity.onChanged.Add(OnComboBoxRarityChanged);
  71. _ui.m_btnAction.onClick.Add(OnClickBtnAction);
  72. _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
  73. _ui.m_btnShow.onClick.Add(OnClickBtnShow);
  74. _ui.m_btnHide.onClick.Add(OnClickBtnHide);
  75. _ui.m_loaShow.onClick.Add(OnClickLoaShow);
  76. _ui.m_btnPhoto.onClick.Add(OnClickBtnPhoto);
  77. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
  78. EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, UpdatePartsListSort);
  79. EventAgent.AddEventListener(ConstMessage.CLOSE_PHOTOGRAPHVIEW, UpdateScene);
  80. _ui.m_partsList2.m_comboBoxRarity.visible = false;
  81. }
  82. protected override void OnShown()
  83. {
  84. base.OnShown();
  85. _rarityIndex = SORT_BY_HIGH_RARITY;
  86. MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DRESS_UP, "mp3"));
  87. _ui.m_comListType1.target.x = _ui.target.width;
  88. _ui.m_comListType2.target.x = _ui.target.width;
  89. _ui.m_partsList.target.x = _ui.target.width;
  90. this.showListType1();
  91. if (_sceneObject == null)
  92. {
  93. _sceneObject = GameObject.Instantiate(_scenePrefab);
  94. EquipDataCache.cacher.setSceneObj(_sceneObject);
  95. }
  96. _ui.m_comboBox.selectedIndex = CustomSuitDataManager.currentIndex;
  97. EquipDataCache.cacher.PutOnCurrentSuitSaved();
  98. }
  99. protected override void OnHide()
  100. {
  101. base.OnHide();
  102. listTypeItem_FreedomDress = null;
  103. MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
  104. if (_sceneObject != null)
  105. {
  106. GameObject.Destroy(_sceneObject);
  107. _sceneObject = null;
  108. }
  109. }
  110. private void OnClickBtnBack()
  111. {
  112. Reset();
  113. this.Hide();
  114. ViewManager.Show(ViewName.MAINUI_VIEW);
  115. }
  116. private void OnClickBtnHome()
  117. {
  118. GameController.GoBackToMainView();
  119. Reset();
  120. }
  121. private void Reset()
  122. {
  123. DressUpMenuItemDataManager.dressFilterType = DressFilterType.None;
  124. DressUpMenuItemDataManager.selectRarityList.Clear();
  125. DressUpMenuItemDataManager.selectScoreList.Clear();
  126. DressUpMenuItemDataManager.selectTagList.Clear();
  127. DressUpMenuItemDataManager.dressSearchTxt = "";
  128. }
  129. private void OnComboBoxChanged()
  130. {
  131. EquipDataCache.cacher.PutOnSuitSaved(_ui.m_comboBox.selectedIndex);
  132. }
  133. private void OnClickListType1Item(EventContext context)
  134. {
  135. GObject typeItem = (GObject)context.data as GObject;
  136. int order = (int)typeItem.data;
  137. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[order - 1];
  138. if (item1.subMenusArr.Length > 0)
  139. {
  140. this.showListType2(item1.subMenusArr);
  141. }
  142. else
  143. {
  144. this.showListParts(item1.type);
  145. }
  146. this.hideListType1();
  147. UpdateListPartsSelected();
  148. }
  149. private void OnClickListType2Item(EventContext context)
  150. {
  151. GObject typeItem = (GObject)context.data as GObject;
  152. int order = (int)typeItem.data;
  153. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[order - 1];
  154. this.showListParts(item2.type);
  155. this.hideListType2();
  156. }
  157. private void OnClickPartsListItem(EventContext context)
  158. {
  159. GObject listItem = (GObject)context.data as GObject;
  160. int id = (int)listItem.data;
  161. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  162. {
  163. this.showListParts2(id);
  164. this.hideListParts();
  165. EquipDataCache.cacher.PutOnSuitCfg(id, true, false);
  166. UpdateBtnAction();
  167. }
  168. else
  169. {
  170. EquipDataCache.cacher.TryCancelSuit(id);
  171. EquipDataCache.cacher.AddOrRemove(id, true);
  172. }
  173. UpdateListPartsSelected();
  174. UpdateListSuitPartsSelected();
  175. }
  176. private void OnClickSuitPartsListItem(EventContext context)
  177. {
  178. GObject listItem = (GObject)context.data as GObject;
  179. int id = (int)listItem.data;
  180. EquipDataCache.cacher.TryCancelSuit(id);
  181. EquipDataCache.cacher.AddOrRemove(id, true);
  182. UpdateListSuitPartsSelected();
  183. UpdateBtnAction();
  184. }
  185. private void OnTouchPad()
  186. {
  187. if (this.currentListType == DressUpListType.List4)
  188. {
  189. this.hideListParts2();
  190. this.showListParts(ConstDressUpItemType.TAO_ZHUANG);
  191. }
  192. else if (this.currentListType == DressUpListType.List3)
  193. {
  194. if (_currentList2 != null)
  195. {
  196. this.showListType2();
  197. }
  198. else
  199. {
  200. this.showListType1();
  201. }
  202. this.hideListParts();
  203. }
  204. else if (this.currentListType == DressUpListType.List2)
  205. {
  206. this.showListType1();
  207. this.hideListType2();
  208. }
  209. }
  210. private void OnClickBtnDelete()
  211. {
  212. EquipDataCache.cacher.TakeOffAll();
  213. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  214. }
  215. private void OnClickBtnSave()
  216. {
  217. CustomSuitDataManager.SaveCurrentSuit(_ui.m_comboBox.selectedIndex);
  218. PromptController.Instance.ShowFloatTextPrompt("保存成功", MessageType.SUCCESS);
  219. }
  220. private void OnComboBoxRarityChanged()
  221. {
  222. _rarityIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  223. this.UpdatePartsListSort();
  224. }
  225. private void OnClickBtnAction()
  226. {
  227. if (!_ui.m_btnAction.grayed)
  228. {
  229. EquipDataCache.cacher.ChangeAction();
  230. }
  231. }
  232. private void OnClickBtnSearch()
  233. {
  234. ViewManager.Show<DressFilterView>(true, new object[] { ViewName.DRESS_UP_VIEW });
  235. }
  236. private void InitLists()
  237. {
  238. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  239. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  240. _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
  241. listType1X = _ui.m_comListType1.target.x;
  242. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width - DressUpView.RIGHT_BLANK;
  243. //一级菜单
  244. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  245. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length;
  246. //_ui.m_comListType1.m_listType1.ResizeToFit(_ui.m_comListType1.m_listType1.numItems);
  247. float maxHeight = _ui.target.height - _ui.m_comListType1.target.y - DressUpView.BOTTOM_BLANK;
  248. if (_ui.m_comListType1.m_listType.height > maxHeight)
  249. {
  250. _ui.m_comListType1.m_listType.height = maxHeight;
  251. }
  252. }
  253. private void showListType1()
  254. {
  255. _currentList2 = null;
  256. currentListType = DressUpListType.List1;
  257. GTween.To(_ui.target.width, listType1X, 0.5f)
  258. .SetTarget(_ui.m_comListType1.target)
  259. .OnUpdate((GTweener t) =>
  260. {
  261. _ui.m_comListType1.target.x = t.value.x;
  262. });
  263. }
  264. private void hideListType1()
  265. {
  266. GTween.To(listType1X, _ui.target.width, 0.5f)
  267. .SetTarget(_ui.m_comListType1.target)
  268. .OnUpdate((GTweener t) =>
  269. {
  270. _ui.m_comListType1.target.x = t.value.x;
  271. });
  272. }
  273. private void showListType2(int[] menuStrArr = null)
  274. {
  275. currentListType = DressUpListType.List2;
  276. if (menuStrArr != null && menuStrArr.Length > 0)
  277. {
  278. int len = menuStrArr.Length;
  279. _currentList2 = menuStrArr.Clone() as int[];
  280. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  281. _ui.m_comListType2.m_listType.numItems = len;
  282. //_ui.m_comListType2.m_listType2.ResizeToFit(_ui.m_comListType2.m_listType2.numItems);
  283. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  284. if (_ui.m_comListType2.m_listType.height > maxHeight)
  285. {
  286. _ui.m_comListType2.m_listType.height = maxHeight;
  287. }
  288. }
  289. GTween.To(_ui.target.width, listType1X, 0.5f)
  290. .SetTarget(_ui.m_comListType2.target)
  291. .OnUpdate((GTweener t) =>
  292. {
  293. _ui.m_comListType2.target.x = t.value.x;
  294. });
  295. }
  296. private void hideListType2()
  297. {
  298. GTween.To(listType1X, _ui.target.width, 0.5f)
  299. .SetTarget(_ui.m_comListType2.target)
  300. .OnUpdate((GTweener t) =>
  301. {
  302. _ui.m_comListType2.target.x = t.value.x;
  303. });
  304. }
  305. private void showListParts(int type)
  306. {
  307. _currentMenuType = type;
  308. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  309. {
  310. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  311. if (_rarityIndex >= SORT_BY_GET_TIME)
  312. {
  313. _rarityIndex = SORT_BY_HIGH_RARITY;
  314. }
  315. }
  316. else
  317. {
  318. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  319. }
  320. this.UpdatePartsListSort();
  321. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  322. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;// - DressUpView.BOTTOM_BLANK;
  323. if (_ui.m_partsList.m_list.height > maxHeight)
  324. {
  325. _ui.m_partsList.m_list.height = maxHeight;
  326. }
  327. currentListType = DressUpListType.List3;
  328. GTween.To(_ui.target.width, partsListX, 0.5f)
  329. .SetTarget(_ui.m_partsList)
  330. .OnUpdate((GTweener t) =>
  331. {
  332. _ui.m_partsList.target.x = t.value.x;
  333. });
  334. UpdateBtnAction();
  335. UpdateListPartsSelected();
  336. }
  337. private void hideListParts()
  338. {
  339. _currentMenuType = 0;
  340. UpdateBtnAction();
  341. GTween.To(partsListX, _ui.target.width, 0.5f)
  342. .SetTarget(_ui.m_partsList)
  343. .OnUpdate((GTweener t) =>
  344. {
  345. _ui.m_partsList.target.x = t.value.x;
  346. });
  347. }
  348. private void showListParts2(int suitId)
  349. {
  350. _currentSuitId = suitId;
  351. _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  352. if (_rarityIndex >= SORT_BY_GET_TIME)
  353. {
  354. _rarityIndex = SORT_BY_HIGH_RARITY;
  355. }
  356. this.UpdateSuitPartsListSort();
  357. _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
  358. float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
  359. if (_ui.m_partsList2.m_list.height > maxHeight)
  360. {
  361. _ui.m_partsList2.m_list.height = maxHeight;
  362. }
  363. currentListType = DressUpListType.List4;
  364. GTween.To(_ui.target.width, partsListX, 0.5f)
  365. .SetTarget(_ui.m_partsList2)
  366. .OnUpdate((GTweener t) =>
  367. {
  368. _ui.m_partsList2.target.x = t.value.x;
  369. });
  370. UpdateBtnAction();
  371. }
  372. private void hideListParts2()
  373. {
  374. _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
  375. UpdateBtnAction();
  376. GTween.To(partsListX, _ui.target.width, 0.5f)
  377. .SetTarget(_ui.m_partsList2)
  378. .OnUpdate((GTweener t) =>
  379. {
  380. _ui.m_partsList2.target.x = t.value.x;
  381. });
  382. }
  383. /********************************************************************************************************************************************/
  384. private void ListType1Item(int index, GObject item)
  385. {
  386. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  387. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
  388. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
  389. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  390. typeItem.target.data = item1.id;
  391. typeItem.m_imgNeed.visible = false;
  392. }
  393. private void ListType2Item(int index, GObject item)
  394. {
  395. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  396. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
  397. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
  398. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  399. typeItem.target.data = item2.id;
  400. typeItem.m_imgNeed.visible = false;
  401. }
  402. private void ListPartsItem(int index, GObject item)
  403. {
  404. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  405. int id = (int)_currentList3[index];
  406. string iconRes = "";
  407. string partName = "";
  408. string ext = "png";
  409. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  410. {
  411. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  412. iconRes = suitCfg.res;
  413. partName = suitCfg.name;
  414. listItem.m_iconSelected.visible = false;
  415. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  416. listItem.m_ScoreType.visible = false;
  417. }
  418. else
  419. {
  420. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  421. iconRes = itemCfg.res;
  422. partName = itemCfg.name;
  423. listItem.m_iconSelected.visible = EquipDataCache.cacher.CheckDressUpItemIsOn(id);
  424. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  425. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType);
  426. listItem.m_ScoreType.visible = true;
  427. int mainScore;
  428. int mainValuel;
  429. ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
  430. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + mainScore);
  431. }
  432. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  433. listItem.m_txtTitle.text = partName;
  434. listItem.target.data = id;
  435. listItem.m_txtScore.visible = false;
  436. //listItem.m_ScoreType.visible = true;
  437. listItem.m_imgNeed.visible = false;
  438. }
  439. private void ListParts2Item(int index, GObject item)
  440. {
  441. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  442. int id = (int)_currentList4[index];
  443. string iconRes = "";
  444. string partName = "";
  445. string ext = "png";
  446. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  447. iconRes = itemCfg.res;
  448. partName = itemCfg.name;
  449. listItem.m_iconSelected.visible = EquipDataCache.cacher.CheckDressUpItemIsOn(id);
  450. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  451. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType);
  452. listItem.m_ScoreType.visible = true;
  453. int mainScore;
  454. int mainValuel;
  455. ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
  456. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + mainScore);
  457. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  458. listItem.m_txtTitle.text = partName;
  459. listItem.target.data = id;
  460. listItem.m_txtScore.visible = false;
  461. //listItem.m_ScoreType.visible = true;
  462. listItem.m_imgNeed.visible = false;
  463. }
  464. private void UpdateListPartsSelected()
  465. {
  466. int count = _ui.m_partsList.m_list.numChildren;
  467. for (int i = 0; i < count; i++)
  468. {
  469. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(i));
  470. int id = (int)listItem.target.data;
  471. if (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG)
  472. {
  473. listItem.m_iconSelected.visible = EquipDataCache.cacher.suitId > 0 && id == EquipDataCache.cacher.suitId;
  474. }
  475. else
  476. {
  477. bool isPutOn = EquipDataCache.cacher.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  478. bool isSuit = !DressUpMenuItemDataManager.CheckIsSceneType(id) && EquipDataCache.cacher.suitId > 0 && SuitCfgManager.Instance.GetItemSuitId(id) == EquipDataCache.cacher.suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  479. bool isSceneSuit = DressUpMenuItemDataManager.CheckIsSceneType(id) && EquipDataCache.cacher.suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  480. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  481. }
  482. }
  483. }
  484. private void UpdateListSuitPartsSelected()
  485. {
  486. int count = _ui.m_partsList2.m_list.numChildren;
  487. for (int i = 0; i < count; i++)
  488. {
  489. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  490. int id = (int)listItem.target.data;
  491. bool isPutOn = EquipDataCache.cacher.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  492. bool isSuit = !DressUpMenuItemDataManager.CheckIsSceneType(id) && EquipDataCache.cacher.suitId > 0 && SuitCfgManager.Instance.GetItemSuitId(id) == EquipDataCache.cacher.suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  493. bool isSceneSuit = DressUpMenuItemDataManager.CheckIsSceneType(id) && EquipDataCache.cacher.suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  494. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  495. }
  496. }
  497. private void UpdatePartsListSort()
  498. {
  499. if (_currentMenuType == 0) return;
  500. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  501. {
  502. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  503. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  504. {
  505. _currentList3 = SuitUtil.SortSuitListByHighRarity(_currentList3);
  506. }
  507. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  508. {
  509. _currentList3 = SuitUtil.SortSuitListByLowRarity(_currentList3);
  510. }
  511. else
  512. {
  513. _currentList3.Reverse();
  514. }
  515. }
  516. else
  517. {
  518. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  519. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  520. {
  521. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighRarity(_currentList3);
  522. }
  523. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  524. {
  525. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowRarity(_currentList3);
  526. }
  527. else
  528. {
  529. _currentList3.Reverse();
  530. }
  531. }
  532. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  533. {
  534. _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3, _currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG);
  535. }
  536. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  537. {
  538. _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3, _currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG);
  539. }
  540. _ui.m_partsList.m_list.RemoveChildrenToPool();
  541. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  542. }
  543. private void UpdateSuitPartsListSort()
  544. {
  545. if (_currentMenuType == 0) return;
  546. _currentList4 = new List<int>(SuitCfgManager.Instance.GetSuitItems(_currentSuitId));
  547. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  548. {
  549. _currentList4 = DressUpMenuItemDataManager.SortItemListByHighRarity(_currentList4);
  550. }
  551. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  552. {
  553. _currentList4 = DressUpMenuItemDataManager.SortItemListByLowRarity(_currentList4);
  554. }
  555. else
  556. {
  557. _currentList4.Reverse();
  558. }
  559. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  560. {
  561. _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4, false);
  562. }
  563. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  564. {
  565. _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4, false);
  566. }
  567. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  568. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  569. }
  570. private void UpdateBtnAction()
  571. {
  572. _ui.m_btnAction.visible = (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG) || this.currentListType == DressUpListType.List4;
  573. if (_ui.m_btnAction.visible)
  574. {
  575. _ui.m_btnAction.grayed = !EquipDataCache.cacher.HasSuitPicRes;
  576. }
  577. }
  578. private void OnClickBtnShow()
  579. {
  580. Timers.inst.Remove(SetBtnShowVisable);
  581. _ui.m_c1.selectedIndex = 0;
  582. _ui.m_btnHide.visible = true;
  583. _ui.m_btnShow.visible = false;
  584. _ui.m_loaShow.visible = false;
  585. }
  586. private void OnClickBtnHide()
  587. {
  588. _ui.m_c1.selectedIndex = 1;
  589. _ui.m_btnHide.visible = false;
  590. _ui.m_btnShow.visible = true;
  591. _ui.m_loaShow.visible = true;
  592. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  593. }
  594. private void OnClickLoaShow()
  595. {
  596. Timers.inst.Remove(SetBtnShowVisable);
  597. _ui.m_btnShow.alpha = 1;
  598. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  599. _ui.m_btnShow.enabled = true;
  600. }
  601. private void OnClickBtnPhoto()
  602. {
  603. if (!ViewManager.Show<PhotographView>())
  604. {
  605. return;
  606. }
  607. _ui.target.visible = false;
  608. this._sceneObject.gameObject.SetActive(false);
  609. }
  610. private void UpdateScene()
  611. {
  612. _ui.target.visible = true;
  613. this._sceneObject.gameObject.SetActive(true);
  614. EquipDataCache.cacher.setSceneObj(_sceneObject);
  615. }
  616. private void SetBtnShowVisable(object param)
  617. {
  618. _ui.m_btnShow.enabled = false;
  619. GTween.To(1, 0, 0.3f).SetTarget(_ui.m_btnShow, TweenPropType.Alpha);
  620. }
  621. protected override void UpdateToCheckGuide(object param)
  622. {
  623. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  624. if (listTypeItem_FreedomDress == null && GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0)
  625. {
  626. int len = _ui.m_comListType1.m_listType.numChildren;
  627. for (int i = 0; i < len; i++)
  628. {
  629. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  630. if (item != null)
  631. {
  632. int menuID = (int)item.target.data;
  633. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  634. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  635. {
  636. listTypeItem_FreedomDress = item;
  637. _ui.m_comListType1.m_listType.ScrollToView(i);
  638. break;
  639. }
  640. }
  641. }
  642. }
  643. if (listTypeItem_FreedomDress != null) GuideController.TryGuide(listTypeItem_FreedomDress.target, ConstGuideId.FREEDOM_DRESS, 3, "套装分类里,可以查看集齐成套的服饰");
  644. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.FREEDOM_DRESS, 4, "点击一键换上", 0);
  645. GuideController.TryGuide(_ui.m_btnSave, ConstGuideId.FREEDOM_DRESS, 5, "搭配好的服饰,可以保存随时查看");
  646. GuideController.TryGuide(_ui.m_btnHome, ConstGuideId.FREEDOM_DRESS, 6, "保存成功,回主界面看看吧");
  647. GuideController.TryCompleteGuide(ConstGuideId.FREEDOM_DRESS, 6);
  648. GuideController.TryGuide(_ui.m_btnPhoto, ConstGuideId.PHOTOGRAPH, 3, "点击拍照");
  649. }
  650. }
  651. }