DressUpView.cs 31 KB

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