ArenaDressUpFightView.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. using UI.DressUp;
  2. using FairyGUI;
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. using System;
  6. using ET;
  7. using System.Collections;
  8. using System.Threading.Tasks;
  9. using UI.Arena;
  10. using UI.CommonGame;
  11. namespace GFGGame
  12. {
  13. public class ArenaDressUpFightView : BaseView
  14. {
  15. private UI_ArenaDressUpFightUI _ui;
  16. private DressUpObj _dressUpData = new DressUpObj();
  17. private ArenaDataManager _dataManager;
  18. public FightRoleData _roleData;
  19. // private int _fightID;
  20. // private int _levelID;
  21. private float listType1X = 0;
  22. private float partsListX = 0;
  23. private DressUpListType currentListType;
  24. private int[] _currentList2;
  25. private GameObject _scenePrefab;
  26. private GameObject _sceneObject;
  27. private List<int> _currentList3 = new List<int>();
  28. private List<int> _currentList4 = new List<int>();
  29. private int _currentMenuType;
  30. private int _currentSuitId;
  31. // private StoryLevelCfg _levelCfg;
  32. // private StoryFightCfg _fightCfg;
  33. private const int SORT_BY_HIGH_SCORE = 0;
  34. private const int SORT_BY_LOW_SCORE = 1;
  35. private int _scoreIndex = SORT_BY_HIGH_SCORE;
  36. private List<LongPressGesture> _listLongPress = new List<LongPressGesture>();
  37. public override void Dispose()
  38. {
  39. if (_sceneObject != null)
  40. {
  41. GameObject.Destroy(_sceneObject);
  42. _sceneObject = null;
  43. }
  44. for (int i = 0; i < _listLongPress.Count; i++)
  45. {
  46. _listLongPress[i].Dispose();
  47. }
  48. _dressUpData.Dispose();
  49. if (_ui != null)
  50. {
  51. _ui.Dispose();
  52. _ui = null;
  53. }
  54. base.Dispose();
  55. }
  56. protected override void Init()
  57. {
  58. base.Init();
  59. packageName = UI_ArenaDressUpFightUI.PACKAGE_NAME;
  60. _ui = UI_ArenaDressUpFightUI.Create();
  61. viewCom = _ui.target;
  62. isfullScreen = true;
  63. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneArenaDressUpFight"));
  64. }
  65. protected override void OnInit()
  66. {
  67. base.OnInit();
  68. _ui.m_btnSearch.visible = true;
  69. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高分优先", "低分优先" };
  70. InitLists();
  71. _ui.m_partsList.m_comboBoxRarity.onChanged.Add(OnComboBoxRarityChanged);
  72. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  73. _ui.m_comListType1.m_listType.onClickItem.Add(OnClickListType1Item);
  74. _ui.m_comListType2.m_listType.onClickItem.Add(OnClickListType2Item);
  75. _ui.m_partsList.m_list.onClickItem.Add(OnClickPartsListItem);
  76. _ui.m_partsList2.m_list.onClickItem.Add(OnClickSuitPartsListItem);
  77. _ui.m_touchPad.onClick.Add(OnTouchPad);
  78. _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
  79. _ui.m_btnNext.onClick.Add(OnClickBtnNext);
  80. _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
  81. _ui.m_partsList2.m_comboBoxRarity.visible = false;
  82. _ui.m_partsList2.m_imgTop.visible = true;
  83. _ui.m_partsList.m_imgTop.visible = false;
  84. }
  85. protected override void AddEventListener()
  86. {
  87. base.AddEventListener();
  88. // EventAgent.AddEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
  89. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
  90. EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, UpdatePartsListSort);
  91. // EventAgent.AddEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateValueInfo);
  92. }
  93. protected override void OnShown()
  94. {
  95. base.OnShown();
  96. _dataManager = ArenaDataManager.Instance;
  97. _roleData = _dataManager.DressupList[_dataManager.SelectThemeIndex];
  98. InstanceZonesDataManager.currentScoreType = _dataManager.ThemeList[_dataManager.SelectThemeIndex];
  99. InstanceZonesDataManager.currentFightTags = _dataManager.DressupList[_dataManager.SelectThemeIndex].tags;
  100. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  101. //一级菜单
  102. _ui.m_comListType1.m_listType.RemoveChildrenToPool();
  103. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
  104. float maxHeight = _ui.target.height - _ui.m_comListType1.m_listType.y - DressUpView.BOTTOM_BLANK;
  105. if (_ui.m_comListType1.m_listType.height > maxHeight)
  106. {
  107. _ui.m_comListType1.m_listType.height = maxHeight;
  108. }
  109. _ui.m_comListType1.target.x = _ui.target.width;
  110. _ui.m_comListType2.target.x = _ui.target.width;
  111. _ui.m_partsList.target.x = _ui.target.width;
  112. _ui.m_partsList2.target.x = _ui.target.width;
  113. this.showListType1();
  114. if (_sceneObject == null)
  115. {
  116. _sceneObject = GameObject.Instantiate(_scenePrefab);
  117. MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false);
  118. GameObject copyObj = _sceneObject.transform.Find("CopyRole").gameObject;
  119. _dressUpData.setSceneObj(copyObj);
  120. }
  121. MyDressUpHelper.dressUpObj.PutOnItemList(_roleData.itemList);
  122. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  123. UpdateValueInfo();
  124. SendLog();
  125. Timers.inst.AddUpdate(CheckGuide);
  126. }
  127. protected override void OnHide()
  128. {
  129. base.OnHide();
  130. if (_sceneObject != null)
  131. {
  132. GameObject.Destroy(_sceneObject);
  133. _sceneObject = null;
  134. }
  135. DressUpMenuItemDataManager.Clear();
  136. Timers.inst.Remove(CheckGuide);
  137. }
  138. protected override void RemoveEventListener()
  139. {
  140. base.RemoveEventListener();
  141. // EventAgent.RemoveEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
  142. EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
  143. EventAgent.RemoveEventListener(ConstMessage.DRESS_SEARCH, UpdatePartsListSort);
  144. // EventAgent.RemoveEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateValueInfo);
  145. }
  146. private void OnClickBtnBack()
  147. {
  148. if (!MyDressUpHelper.CheckPutOnFinish())
  149. {
  150. AlertUI.Show("当前主题尚未穿戴完整,是否确定退出?")
  151. .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
  152. {
  153. ViewManager.GoBackFrom(typeof(ArenaDressUpFightView).FullName);
  154. });
  155. }
  156. else
  157. {
  158. ViewManager.GoBackFrom(typeof(ArenaDressUpFightView).FullName);
  159. }
  160. }
  161. private void OnClickBtnHome()
  162. {
  163. AlertUI.Show("是否返回?")
  164. .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
  165. {
  166. GameController.GoBackToMainView();
  167. });
  168. }
  169. private void UpdateValueInfo()
  170. {
  171. FightDataManager.Instance.SetItemScoreList(_roleData);
  172. ScoreSystemData.Instance.SetEquipScoresWithPartId(_roleData);
  173. ArenaViewManager.Instance.UpdateValue(_ui.m_comValueInfo.target, _dataManager.SelectThemeIndex, _dataManager.DressupList);
  174. }
  175. private void OnClickListType1Item(EventContext context)
  176. {
  177. // GuideController.HideGuide();
  178. GObject typeItem = context.data as GObject;
  179. int order = (int)typeItem.data;
  180. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[order - 1];
  181. if (item1.subMenusArr.Length > 0)
  182. {
  183. this.showListType2(item1.subMenusArr);
  184. }
  185. else
  186. {
  187. if (this.showListParts(item1.type) == false)
  188. {
  189. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  190. return;
  191. }
  192. this.showListParts(item1.type);
  193. }
  194. this.hideListType1();
  195. UpdateListPartsSelected();
  196. }
  197. private void OnClickListType2Item(EventContext context)
  198. {
  199. GObject typeItem = context.data as GObject;
  200. int order = (int)typeItem.data;
  201. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[order - 1];
  202. if (this.showListParts(item2.type) == false)
  203. {
  204. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  205. return;
  206. }
  207. this.hideListType2();
  208. }
  209. private void OnClickPartsListItem(EventContext context)
  210. {
  211. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  212. {
  213. return;
  214. }
  215. GObject listItem = context.data as GObject;
  216. int id = (int)listItem.data;
  217. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  218. {
  219. this.showListParts2(id);
  220. this.hideListParts();
  221. MyDressUpHelper.dressUpObj.PutOnItemList(MyDressUpHelper.GetSuitFightItems(id));
  222. }
  223. else
  224. {
  225. bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
  226. bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  227. bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
  228. bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
  229. if (isOrnament && !isDress && !isHasSame && isMaxCount)
  230. {
  231. PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
  232. return;
  233. }
  234. MyDressUpHelper.dressUpObj.CheckCancelActionWhenPutOn(id);
  235. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  236. }
  237. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  238. UpdateListPartsSelected();
  239. UpdateListSuitPartsSelected();
  240. UpdateValueInfo();
  241. }
  242. private void OnClickSuitPartsListItem(EventContext context)
  243. {
  244. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  245. {
  246. return;
  247. }
  248. GObject listItem = (GObject)context.data as GObject;
  249. int id = (int)listItem.data;
  250. bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
  251. bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  252. bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
  253. bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
  254. if (isOrnament && !isDress && !isHasSame && isMaxCount)
  255. {
  256. PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
  257. return;
  258. }
  259. MyDressUpHelper.dressUpObj.CheckCancelActionWhenPutOn(id);
  260. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  261. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  262. UpdateListSuitPartsSelected();
  263. UpdateValueInfo();
  264. }
  265. private void OnLongPress(EventContext context)
  266. {
  267. LongPressGesture gesture = (LongPressGesture)context.sender;
  268. int itemId = (int)gesture.host.data;
  269. GoodsItemTipsController.ShowItemTips(itemId);
  270. }
  271. private void OnTouchPad()
  272. {
  273. if (this.currentListType == DressUpListType.List4)
  274. {
  275. this.hideListParts2();
  276. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  277. }
  278. else if (this.currentListType == DressUpListType.List3)
  279. {
  280. if (_currentList2 != null)
  281. {
  282. this.showListType2(_currentList2);
  283. }
  284. else
  285. {
  286. this.showListType1();
  287. }
  288. this.hideListParts();
  289. }
  290. else if (this.currentListType == DressUpListType.List2)
  291. {
  292. this.showListType1();
  293. this.hideListType2();
  294. }
  295. }
  296. private void OnClickBtnDelete()
  297. {
  298. MyDressUpHelper.dressUpObj.TakeOffAll();
  299. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  300. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  301. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  302. UpdateListPartsSelected();
  303. UpdateListSuitPartsSelected();
  304. }
  305. private void OnClickBtnNext()
  306. {
  307. if (!MyDressUpHelper.CheckPutOnFinish())
  308. {
  309. AlertUI.Show("换好衣服才能进行下一步哦~").SetRightButton(true, "好的");
  310. }
  311. else
  312. {
  313. Timers.inst.StartCoroutine(ScreenShotTex());
  314. }
  315. }
  316. private IEnumerator ScreenShotTex()
  317. {
  318. _dressUpData.TakeOffAll();
  319. _dressUpData.PutOnItemList(MyDressUpHelper.dressUpObj.itemList);
  320. Camera camera = _sceneObject.transform.Find("FightCamera").gameObject.GetComponent<Camera>();
  321. ArenaViewManager.Instance.textureDic[_dataManager.SelectThemeIndex] = FightDataManager.Instance.GetPrintscreenNTexture(camera);
  322. yield return new WaitForEndOfFrame();
  323. DressUpFinish();
  324. }
  325. private void DressUpFinish()
  326. {
  327. if (CardDataManager.GetCardListByRarity(0).Count > 0)
  328. {
  329. ViewManager.Show<StoryCardChoose>(InstanceZonesDataManager.currentScoreType);
  330. }
  331. else
  332. {
  333. ArenaSproxy.ReqChangeArenaDressup(_dataManager.SelectThemeIndex, 0, MyDressUpHelper.dressUpObj.itemList).Coroutine();
  334. }
  335. }
  336. private void OnClickBtnRecommend()
  337. {
  338. if (this.currentListType == DressUpListType.List4)
  339. {
  340. this.hideListParts2();
  341. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  342. }
  343. MyDressUpHelper.dressUpObj.CheckCancelActionWhenPutOn(_currentSuitId);
  344. MyDressUpHelper.PutOnRecommendItems2();
  345. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  346. UpdateListPartsSelected();
  347. UpdateListSuitPartsSelected();
  348. }
  349. private void InitLists()
  350. {
  351. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  352. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  353. _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
  354. listType1X = _ui.m_comListType1.target.x;
  355. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width;
  356. //一级菜单
  357. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  358. }
  359. private void showListType1()
  360. {
  361. _currentList2 = null;
  362. currentListType = DressUpListType.List1;
  363. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
  364. GTween.To(_ui.target.width, listType1X, 0.5f)
  365. .SetTarget(_ui.m_comListType1.target)
  366. .OnUpdate((GTweener t) =>
  367. {
  368. _ui.m_comListType1.target.x = t.value.x;
  369. });
  370. }
  371. private void hideListType1()
  372. {
  373. GTween.To(listType1X, _ui.target.width, 0.5f)
  374. .SetTarget(_ui.m_comListType1.target)
  375. .OnUpdate((GTweener t) =>
  376. {
  377. _ui.m_comListType1.target.x = t.value.x;
  378. });
  379. }
  380. private void showListType2(int[] menuStrArr = null)
  381. {
  382. currentListType = DressUpListType.List2;
  383. if (menuStrArr != null && menuStrArr.Length > 0)
  384. {
  385. int len = menuStrArr.Length;
  386. _currentList2 = menuStrArr.Clone() as int[];
  387. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  388. _ui.m_comListType2.m_listType.numItems = len;
  389. //_ui.m_listType2.ResizeToFit(_ui.m_listType2.numItems);
  390. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  391. if (_ui.m_comListType2.m_listType.height > maxHeight)
  392. {
  393. _ui.m_comListType2.m_listType.height = maxHeight;
  394. }
  395. }
  396. GTween.To(_ui.target.width, listType1X, 0.5f)
  397. .SetTarget(_ui.m_comListType2.target)
  398. .OnUpdate((GTweener t) =>
  399. {
  400. _ui.m_comListType2.target.x = t.value.x;
  401. });
  402. }
  403. private void hideListType2()
  404. {
  405. GTween.To(listType1X, _ui.target.width, 0.5f)
  406. .SetTarget(_ui.m_comListType2.target)
  407. .OnUpdate((GTweener t) =>
  408. {
  409. _ui.m_comListType2.target.x = t.value.x;
  410. });
  411. }
  412. private bool showListParts(int type, bool selectItem = false)
  413. {
  414. _currentMenuType = type;
  415. UpdatePartsListSort();
  416. if (_ui.m_partsList.m_list.numItems <= 0) return false;
  417. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  418. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;
  419. if (_ui.m_partsList.m_list.height > maxHeight)
  420. {
  421. _ui.m_partsList.m_list.height = maxHeight;
  422. }
  423. if (selectItem)
  424. {
  425. int itemId = MyDressUpHelper.dressUpObj.GetItemIdBuyType(_currentMenuType);
  426. if (itemId > 0)
  427. {
  428. int index = _currentList3.IndexOf(itemId);
  429. _ui.m_partsList.m_list.ScrollToView(index);
  430. }
  431. }
  432. currentListType = DressUpListType.List3;
  433. GTween.To(_ui.target.width, partsListX, 0.5f)
  434. .SetTarget(_ui.m_partsList)
  435. .OnUpdate((GTweener t) =>
  436. {
  437. _ui.m_partsList.target.x = t.value.x;
  438. });
  439. UpdateListPartsSelected();
  440. return true;
  441. }
  442. private void OnComboBoxRarityChanged()
  443. {
  444. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  445. this.UpdatePartsListSort();
  446. }
  447. private void UpdatePartsListSort()
  448. {
  449. if (_currentMenuType == 0) return;
  450. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  451. {
  452. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  453. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  454. {
  455. _currentList3 = SuitUtil.SortSuitListByHighScore(_currentList3);
  456. }
  457. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  458. {
  459. _currentList3 = SuitUtil.SortSuitListByLowScore(_currentList3);
  460. }
  461. else
  462. {
  463. _currentList3.Reverse();
  464. }
  465. }
  466. else
  467. {
  468. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  469. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  470. {
  471. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3);
  472. }
  473. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  474. {
  475. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3);
  476. }
  477. else
  478. {
  479. _currentList3.Reverse();
  480. }
  481. }
  482. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  483. {
  484. _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
  485. }
  486. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  487. {
  488. _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
  489. }
  490. _ui.m_partsList.m_list.RemoveChildrenToPool();
  491. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  492. }
  493. private void UpdateSuitPartsListSort()
  494. {
  495. if (_currentMenuType == 0) return;
  496. _currentList4 = new List<int>(SuitCfgArray.Instance.GetSuitItems(_currentSuitId, true));
  497. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  498. {
  499. _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4);
  500. }
  501. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  502. {
  503. _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4);
  504. }
  505. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  506. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  507. }
  508. private void hideListParts()
  509. {
  510. GTween.To(partsListX, _ui.target.width, 0.5f)
  511. .SetTarget(_ui.m_partsList)
  512. .OnUpdate((GTweener t) =>
  513. {
  514. _ui.m_partsList.target.x = t.value.x;
  515. });
  516. }
  517. private void showListParts2(int suitId)
  518. {
  519. _currentSuitId = suitId;
  520. _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  521. this.UpdateSuitPartsListSort();
  522. _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
  523. float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
  524. if (_ui.m_partsList2.m_list.height > maxHeight)
  525. {
  526. _ui.m_partsList2.m_list.height = maxHeight;
  527. }
  528. currentListType = DressUpListType.List4;
  529. GTween.To(_ui.target.width, partsListX, 0.5f)
  530. .SetTarget(_ui.m_partsList2)
  531. .OnUpdate((GTweener t) =>
  532. {
  533. _ui.m_partsList2.target.x = t.value.x;
  534. });
  535. }
  536. private void hideListParts2()
  537. {
  538. _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
  539. GTween.To(partsListX, _ui.target.width, 0.5f)
  540. .SetTarget(_ui.m_partsList2)
  541. .OnUpdate((GTweener t) =>
  542. {
  543. _ui.m_partsList2.target.x = t.value.x;
  544. });
  545. }
  546. private void ListType1Item(int index, GObject item)
  547. {
  548. UI.DressUp.UI_TypeItem typeItem = UI.DressUp.UI_TypeItem.Proxy(item);
  549. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
  550. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
  551. typeItem.m_txtname.text = item1.name;
  552. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  553. typeItem.target.data = item1.id;
  554. typeItem.m_imgNeed.visible = false;
  555. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.id);
  556. UI.DressUp.UI_TypeItem.ProxyEnd();
  557. }
  558. private void ListType2Item(int index, GObject item)
  559. {
  560. UI.DressUp.UI_TypeItem typeItem = UI.DressUp.UI_TypeItem.Proxy(item);
  561. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
  562. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
  563. typeItem.m_txtname.text = item2.name;
  564. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  565. typeItem.target.data = item2.id;
  566. // var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  567. typeItem.m_imgNeed.visible = false;
  568. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.id);
  569. UI.DressUp.UI_TypeItem.ProxyEnd();
  570. }
  571. private void ListPartsItem(int index, GObject item)
  572. {
  573. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  574. int id = (int)_currentList3[index];
  575. string iconRes = "";
  576. string partName = "";
  577. string ext = "png";
  578. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  579. {
  580. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  581. iconRes = suitCfg.res;
  582. partName = suitCfg.name;
  583. listItem.m_iconSelected.visible = false;
  584. listItem.m_txtScore.text = "" + SuitUtil.GetSuitScore(id);
  585. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  586. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.rarity;
  587. listItem.m_imgNew.visible = false;
  588. }
  589. else
  590. {
  591. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  592. iconRes = itemCfg.res;
  593. partName = itemCfg.name;
  594. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  595. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _roleData.tags);
  596. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  597. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  598. listItem.m_imgNew.visible = isNew;
  599. if (isNew)
  600. {
  601. ItemProxy.ReqSetItemRead(id).Coroutine();
  602. }
  603. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  604. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  605. }
  606. if (listItem.target.data == null)
  607. {
  608. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  609. longPressGesture.once = true;
  610. longPressGesture.onAction.Add(OnLongPress);
  611. _listLongPress.Add(longPressGesture);
  612. }
  613. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  614. listItem.m_ScoreType.url = "ui://CommonGame/kp_sx_" + InstanceZonesDataManager.currentScoreType;
  615. listItem.m_txtTitle.text = partName;
  616. listItem.target.data = id;
  617. listItem.m_imgNeed.visible = false;
  618. UI_PartsListItem.ProxyEnd();
  619. }
  620. private void ListParts2Item(int index, GObject item)
  621. {
  622. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  623. int id = (int)_currentList4[index];
  624. string iconRes = "";
  625. string partName = "";
  626. string ext = "png";
  627. if (listItem.target.data == null)
  628. {
  629. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  630. longPressGesture.once = true;
  631. longPressGesture.onAction.Add(OnLongPress);
  632. _listLongPress.Add(longPressGesture);
  633. }
  634. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  635. iconRes = itemCfg.res;
  636. partName = itemCfg.name;
  637. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  638. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  639. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  640. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  641. listItem.m_ScoreType.visible = true;
  642. // int mainScore;
  643. // int mainValuel;
  644. // ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
  645. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + InstanceZonesDataManager.currentScoreType);
  646. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _dataManager.DressupList[_dataManager.SelectThemeIndex].tags);
  647. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  648. listItem.m_txtTitle.text = partName;
  649. listItem.target.data = id;
  650. // listItem.m_txtScore.visible = false;
  651. //listItem.m_ScoreType.visible = true;
  652. listItem.m_imgNeed.visible = false;
  653. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  654. listItem.m_imgNew.visible = isNew;
  655. if (isNew)
  656. {
  657. ItemProxy.ReqSetItemRead(id).Coroutine();
  658. }
  659. UI_PartsListItem.ProxyEnd();
  660. }
  661. private void UpdateListPartsSelected()
  662. {
  663. int count = _ui.m_partsList.m_list.numChildren;
  664. int suitId = MyDressUpHelper.dressUpObj.suitId;
  665. for (int i = 0; i < count; i++)
  666. {
  667. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(i));
  668. int id = (int)listItem.target.data;
  669. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  670. {
  671. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  672. }
  673. else
  674. {
  675. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  676. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  677. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  678. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  679. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  680. }
  681. UI_PartsListItem.ProxyEnd();
  682. }
  683. }
  684. private void UpdateListSuitPartsSelected()
  685. {
  686. int count = _ui.m_partsList2.m_list.numChildren;
  687. int suitId = MyDressUpHelper.dressUpObj.suitId;
  688. for (int i = 0; i < count; i++)
  689. {
  690. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  691. int id = (int)listItem.target.data;
  692. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  693. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  694. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  695. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  696. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  697. UI_PartsListItem.ProxyEnd();
  698. }
  699. }
  700. private void OnClickBtnSearch()
  701. {
  702. ViewManager.Show<DressFilterView>(false, new object[] { ViewName.DRESS_UP_VIEW });
  703. }
  704. private void SendLog()
  705. {
  706. }
  707. private void CheckGuide(object param)
  708. {
  709. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0
  710. || GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0
  711. || GuideDataManager.IsGuideFinish(ConstGuideId.AUTOPLAY_FIGHT) <= 0)
  712. {
  713. UpdateToCheckGuide(null);
  714. }
  715. else
  716. {
  717. Timers.inst.Remove(CheckGuide);
  718. }
  719. }
  720. protected override void UpdateToCheckGuide(object param)
  721. {
  722. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  723. }
  724. protected override void TryCompleteGuide()
  725. {
  726. base.TryCompleteGuide();
  727. }
  728. }
  729. }