DressUpFightView.cs 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115
  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. namespace GFGGame
  9. {
  10. public class DressUpFightView : BaseView
  11. {
  12. private UI_DressUpFightUI _ui;
  13. private int _fightID;
  14. private int _levelID;
  15. private float listType1X = 0;
  16. private float partsListX = 0;
  17. private DressUpListType currentListType;
  18. private int[] _currentList2;
  19. private GameObject _scenePrefab;
  20. private GameObject _sceneObject;
  21. private List<int> _currentList3 = new List<int>();
  22. private List<int> _currentList4 = new List<int>();
  23. private int _currentMenuType;
  24. private int _currentSuitId;
  25. private StoryLevelCfg _levelCfg;
  26. private StoryFightCfg _fightCfg;
  27. private const int SORT_BY_HIGH_SCORE = 0;
  28. private const int SORT_BY_LOW_SCORE = 1;
  29. private int _scoreIndex = SORT_BY_HIGH_SCORE;
  30. private List<LongPressGesture> _listLongPress = new List<LongPressGesture>();
  31. public override void Dispose()
  32. {
  33. if (_sceneObject != null)
  34. {
  35. GameObject.Destroy(_sceneObject);
  36. _sceneObject = null;
  37. }
  38. for (int i = 0; i < _listLongPress.Count; i++)
  39. {
  40. _listLongPress[i].Dispose();
  41. }
  42. if (_ui != null)
  43. {
  44. _ui.Dispose();
  45. _ui = null;
  46. }
  47. base.Dispose();
  48. }
  49. protected override void Init()
  50. {
  51. base.Init();
  52. packageName = UI_DressUpFightUI.PACKAGE_NAME;
  53. _ui = UI_DressUpFightUI.Create();
  54. viewCom = _ui.target;
  55. isfullScreen = true;
  56. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneDressUpFight"));
  57. _ui.m_btnClose.width = GRoot.inst.width;
  58. _ui.m_btnClose.height = GRoot.inst.height;
  59. _ui.m_btnClose.AddRelation(GRoot.inst, RelationType.Size);
  60. }
  61. protected override void OnInit()
  62. {
  63. base.OnInit();
  64. _ui.m_groupTaskHint.visible = false;
  65. _ui.m_btnRepeal.visible = false;
  66. _ui.m_btnRenewal.visible = false;
  67. _ui.m_btnSearch.visible = true;
  68. // _ui.m_comboBox.items = new string[] { "我的套装一", "我的套装二", "我的套装三", "我的套装四", "我的套装五", "我的套装六" };
  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_btnHome.onClick.Add(OnClickBtnHome);
  74. // _ui.m_btnClothingShop.onClick.Add(OnClickBtnClothingShop);
  75. // _ui.m_comboBox.onChanged.Add(OnComboBoxChanged);
  76. _ui.m_comListType1.m_listType.onClickItem.Add(OnClickListType1Item);
  77. _ui.m_comListType2.m_listType.onClickItem.Add(OnClickListType2Item);
  78. _ui.m_partsList.m_list.onClickItem.Add(OnClickPartsListItem);
  79. _ui.m_partsList2.m_list.onClickItem.Add(OnClickSuitPartsListItem);
  80. _ui.m_touchPad.onClick.Add(OnTouchPad);
  81. _ui.m_btnHint.onClick.Add(OnClickBtnHint);
  82. _ui.m_btnGuide.onClick.Add(OnTouchPad);
  83. _ui.m_btnClose.onClick.Add(OnClickBtnClose);
  84. _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
  85. _ui.m_btnNext.onClick.Add(OnClickBtnNext);
  86. _ui.m_btnRecommend.onClick.Add(OnClickBtnRecommend);
  87. _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
  88. _ui.m_btnAutoPlay.onClick.Add(OnClickBtnAutoPlay);
  89. _ui.m_compNeed.target.onClick.Add(OnClickComNeed);
  90. _ui.m_compNeed.m_listTag.itemRenderer = RenderListTagItem;
  91. // _ui.m_btnShow.onClick.Add(OnClickBtnShow);
  92. // _ui.m_btnHide.onClick.Add(OnClickBtnHide);
  93. // _ui.m_loaShow.onClick.Add(OnClickLoaShow);
  94. // _ui.m_btnHide.visible = false;
  95. // EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdatePartsListSort);
  96. _ui.m_partsList2.m_comboBoxRarity.visible = false;
  97. }
  98. protected override void AddEventListener()
  99. {
  100. base.AddEventListener();
  101. EventAgent.AddEventListener(ConstMessage.CARD_CHOOSE, OnClickBtnPhotograph);
  102. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
  103. EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, UpdatePartsListSort);
  104. EventAgent.AddEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
  105. }
  106. protected override void OnShown()
  107. {
  108. base.OnShown();
  109. InstanceZonesDataManager.usedRecommend = false;
  110. // _ui.m_comboBox.title = "我的套装";
  111. _ui.m_txtRecommendCount.SetVar("v1", "" + GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.RecommendCount)).FlushVars();
  112. _ui.m_txtRecommendCount.SetVar("v2", GlobalCfgArray.globalCfg.recommendCount.ToString()).FlushVars();
  113. _ui.m_btnRecommend.enabled = true;// GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.RecommendCount) > 0;
  114. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  115. _ui.m_btnAutoPlay.selected = EquipDataCache.cacher.autoPlay;
  116. _ui.m_btnAutoPlay.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.FUNCTION_AUTOPLAY_FIGHT, false);
  117. _levelID = (int)viewData;
  118. InstanceZonesDataManager.currentLevelCfgId = _levelID;
  119. _levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  120. _fightCfg = StoryFightCfgArray.Instance.GetCfg(_levelCfg.fightID);
  121. if (_levelCfg.type == ConstInstanceZonesType.Field)
  122. {
  123. _fightCfg.scoreType = FieldDataManager.Instance.fieldInfos.theme;
  124. _ui.m_btnAutoPlay.visible = false;
  125. }
  126. _ui.m_compNeed.target.visible = _fightCfg.needItemId > 0 || _fightCfg.needSuitId > 0 || _fightCfg.needTagsArr.Length > 0;
  127. if (_ui.m_compNeed.target.visible)
  128. {
  129. _ui.m_compNeed.m_c1.selectedIndex = 0;
  130. if (_fightCfg.needItemId > 0)
  131. {
  132. _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetItemName(_fightCfg.needItemId);
  133. _ui.m_compNeed.target.data = _fightCfg.needItemId;
  134. }
  135. else if (_fightCfg.needSuitId > 0)
  136. {
  137. _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetSuitName(_fightCfg.needSuitId);
  138. _ui.m_compNeed.target.data = _fightCfg.needSuitId;
  139. }
  140. else
  141. {
  142. _ui.m_compNeed.m_c1.selectedIndex = 1;
  143. _ui.m_compNeed.m_listTag.numItems = _fightCfg.needTagsArr.Length;
  144. }
  145. }
  146. InstanceZonesDataManager.currentScoreType = _fightCfg.scoreType;
  147. //一级菜单
  148. _ui.m_comListType1.m_listType.RemoveChildrenToPool();
  149. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 1;
  150. //_ui.m_comListType1.m_listType1.ResizeToFit(_ui.m_listType1.numItems);
  151. float maxHeight = _ui.target.height - _ui.m_comListType1.m_listType.y - DressUpView.BOTTOM_BLANK;
  152. if (_ui.m_comListType1.m_listType.height > maxHeight)
  153. {
  154. _ui.m_comListType1.m_listType.height = maxHeight;
  155. }
  156. _ui.m_comListType1.target.x = _ui.target.width;
  157. _ui.m_comListType2.target.x = _ui.target.width;
  158. _ui.m_partsList.target.x = _ui.target.width;
  159. _ui.m_partsList2.target.x = _ui.target.width;
  160. _ui.m_scoreType.url = "ui://CommonGame/kp_sx_" + _fightCfg.scoreType;
  161. this.showListType1();
  162. if (_sceneObject == null)
  163. {
  164. _sceneObject = GameObject.Instantiate(_scenePrefab);
  165. EquipDataCache.cacher.setSceneObj(_sceneObject);
  166. EquipDataCache.cacher.PutOnDefaultSuitSaved();
  167. }
  168. UpdateScore();
  169. SendLog();
  170. Timers.inst.AddUpdate(CheckGuide);
  171. }
  172. protected override void OnHide()
  173. {
  174. base.OnHide();
  175. _ui.m_groupTaskHint.visible = false;
  176. if (_sceneObject != null)
  177. {
  178. GameObject.Destroy(_sceneObject);
  179. _sceneObject = null;
  180. }
  181. _fightCfg = null;
  182. _levelCfg = null;
  183. DressUpMenuItemDataManager.Clear();
  184. Timers.inst.Remove(CheckGuide);
  185. }
  186. protected override void RemoveEventListener()
  187. {
  188. base.RemoveEventListener();
  189. EventAgent.RemoveEventListener(ConstMessage.CARD_CHOOSE, OnClickBtnPhotograph);
  190. EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
  191. EventAgent.RemoveEventListener(ConstMessage.DRESS_SEARCH, UpdatePartsListSort);
  192. EventAgent.RemoveEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
  193. }
  194. private void OnClickBtnBack()
  195. {
  196. AlertUI.Show("是否确定退出?")
  197. .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
  198. {
  199. if (_levelCfg.type == ConstInstanceZonesType.Studio && _levelCfg.subType != ConstInstanceZonesSubType.Hard3)
  200. {
  201. ViewManager.Show(StudioDataManager.Instance.VIEW_NAME, new object[] { StudioDataManager.Instance.TYPE_SELECT_INDEX, StudioDataManager.Instance.PROPERTY_SELECT_INDEX }, ViewManager.GetGoBackDatas(StudioDataManager.Instance.VIEW_NAME));
  202. }
  203. else if (_levelCfg.type == ConstInstanceZonesType.Studio && _levelCfg.subType == ConstInstanceZonesSubType.Hard3)
  204. {
  205. ViewManager.Show<StudioFilingView>(null, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName));
  206. }
  207. else if (_levelCfg.type == ConstInstanceZonesType.Field)
  208. {
  209. ViewManager.GoBackFrom(ViewName.DRESS_UP_FIGHT_VIEW);
  210. }
  211. else
  212. {
  213. // ViewManager.GoBackFrom(ViewName.STORY_CHAPTER_VIEW);
  214. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, _levelCfg.chapterId);//, new object[] { ViewName.STORY_CHAPTER_LIST_VIEW }
  215. }
  216. EquipDataCache.cacher.TakeOffAll();
  217. this.Hide();
  218. });
  219. // ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter);
  220. }
  221. private void OnClickBtnHome()
  222. {
  223. AlertUI.Show("是否返回?")
  224. .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
  225. {
  226. EquipDataCache.cacher.TakeOffAll();
  227. GameController.GoBackToMainView();
  228. });
  229. }
  230. private void OnClickBtnClothingShop()
  231. {
  232. ViewManager.Show(ViewName.CLOTHING_SHOP_VIEW, new object[] { null, _fightCfg.scoreType }, null, false, true);
  233. }
  234. private void OnClickListType1Item(EventContext context)
  235. {
  236. // GuideController.HideGuide();
  237. GObject typeItem = context.data as GObject;
  238. int order = (int)typeItem.data;
  239. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[order - 1];
  240. if (item1.subMenusArr.Length > 0)
  241. {
  242. this.showListType2(item1.subMenusArr);
  243. }
  244. else
  245. {
  246. if (this.showListParts(item1.type) == false)
  247. {
  248. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  249. return;
  250. }
  251. this.showListParts(item1.type);
  252. }
  253. this.hideListType1();
  254. UpdateListPartsSelected();
  255. }
  256. private void OnClickListType2Item(EventContext context)
  257. {
  258. GObject typeItem = context.data as GObject;
  259. int order = (int)typeItem.data;
  260. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[order - 1];
  261. if (this.showListParts(item2.type) == false)
  262. {
  263. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  264. return;
  265. }
  266. this.hideListType2();
  267. }
  268. private void OnClickPartsListItem(EventContext context)
  269. {
  270. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  271. {
  272. return;
  273. }
  274. GObject listItem = context.data as GObject;
  275. int id = (int)listItem.data;
  276. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  277. {
  278. this.showListParts2(id);
  279. this.hideListParts();
  280. EquipDataCache.cacher.PutOnSuitCfg(id, false, true);
  281. }
  282. else
  283. {
  284. EquipDataCache.cacher.TryCancelSuit(id);
  285. EquipDataCache.cacher.AddOrRemove(id, true);
  286. }
  287. UpdateListPartsSelected();
  288. UpdateListSuitPartsSelected();
  289. }
  290. private void OnClickSuitPartsListItem(EventContext context)
  291. {
  292. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  293. {
  294. return;
  295. }
  296. GObject listItem = (GObject)context.data as GObject;
  297. int id = (int)listItem.data;
  298. EquipDataCache.cacher.TryCancelSuit(id);
  299. EquipDataCache.cacher.AddOrRemove(id, true);
  300. UpdateListSuitPartsSelected();
  301. }
  302. private void OnLongPress(EventContext context)
  303. {
  304. LongPressGesture gesture = (LongPressGesture)context.sender;
  305. int itemId = (int)gesture.host.data;
  306. GoodsItemTipsController.ShowItemTips(itemId);
  307. }
  308. private void OnTouchPad()
  309. {
  310. if (this.currentListType == DressUpListType.List4)
  311. {
  312. this.hideListParts2();
  313. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  314. }
  315. else if (this.currentListType == DressUpListType.List3)
  316. {
  317. if (_currentList2 != null)
  318. {
  319. this.showListType2(_currentList2);
  320. }
  321. else
  322. {
  323. this.showListType1();
  324. }
  325. this.hideListParts();
  326. }
  327. else if (this.currentListType == DressUpListType.List2)
  328. {
  329. this.showListType1();
  330. this.hideListType2();
  331. }
  332. }
  333. private void OnClickBtnHint()
  334. {
  335. this.ShowTaskHint();
  336. }
  337. private void OnClickBtnDelete()
  338. {
  339. EquipDataCache.cacher.TakeOffAll();
  340. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  341. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  342. }
  343. private void OnClickBtnClose()
  344. {
  345. _ui.m_groupTaskHint.visible = false;
  346. }
  347. private void OnClickBtnNext()
  348. {
  349. if (!EquipDataCache.cacher.CheckPutOnFinish())
  350. {
  351. AlertUI.Show("只有换好衣服才能出门哦!")
  352. .SetRightButton(true, "好的");
  353. return;
  354. }
  355. int _suitId = EquipDataCache.cacher.CheckCurDressIsSuit(); ;
  356. if (_fightCfg.needItemId > 0 && (_suitId <= 0 && EquipDataCache.cacher.equipDatas.IndexOf(_fightCfg.needItemId) < 0 || _suitId > 0 && Array.IndexOf(SuitCfgArray.Instance.GetCfg(_suitId).partsArr, _fightCfg.needItemId) < 0) || _fightCfg.needSuitId > 0 && _suitId != _fightCfg.needSuitId)
  357. {
  358. AlertUI.Show("未穿戴必需品。").SetRightButton(true, "好的");
  359. return;
  360. }
  361. if (CardDataManager.GetCardListByRarity(0).Count > 0)
  362. {
  363. ViewManager.Show<StoryCardChoose>(_fightCfg.scoreType);
  364. }
  365. else
  366. {
  367. OnClickBtnPhotograph();
  368. }
  369. }
  370. private void OnClickBtnPhotograph()
  371. {
  372. Timers.inst.StartCoroutine(ScreenShotTex());
  373. }
  374. private IEnumerator ScreenShotTex()
  375. {
  376. ItemCfg bgItemCfg = ItemCfgArray.Instance.GetCfg(EquipDataCache.cacher.bgId);
  377. string bgName = string.Format(DressUpUtil.FORMAT_SPRITE_NAME, bgItemCfg.subType, 1);
  378. GameObject bg = _sceneObject.transform.Find(bgName).gameObject;
  379. bg.SetActive(false);
  380. GRoot.inst.visible = false;
  381. yield return new WaitForEndOfFrame();
  382. Rect rect = new Rect(0, 0, UnityEngine.Screen.width, UnityEngine.Screen.height);
  383. Texture2D tex = new Texture2D((int)rect.width, (int)rect.height, TextureFormat.ARGB32, false);//新建一个Texture2D对象
  384. tex.ReadPixels(rect, 0, 0);//读取像素,屏幕左下角为0点
  385. tex.Apply();//保存像素信息
  386. EquipDataCache.cacher.nTexture = new NTexture(tex);
  387. GRoot.inst.visible = true;
  388. bg.SetActive(true);
  389. StartCalculateScore();
  390. }
  391. private void StartCalculateScore()
  392. {
  393. //不可移动代码位置
  394. bool hasFightTarget = _fightCfg.targetName != null && _fightCfg.targetName.Length > 0;
  395. if (_levelCfg.type == ConstInstanceZonesType.Field)
  396. {
  397. FieldFightDataManager.Instance.CurrentCardId = InstanceZonesDataManager.currentCardId;
  398. FieldFightDataManager.Instance.CurrentScoreType = InstanceZonesDataManager.currentScoreType;
  399. FieldFightDataManager.Instance.currentLevelCfgId = InstanceZonesDataManager.currentLevelCfgId;
  400. FieldFightDataManager.Instance.equipDatas = EquipDataCache.cacher.equipDatas;
  401. }
  402. if (hasFightTarget)
  403. {
  404. ViewManager.Show(ViewName.STORY_FIGHT_TARGET_VIEW);
  405. }
  406. else
  407. {
  408. ViewManager.Show(ViewName.STORY_FIGHT_SINGLE_VIEW);
  409. }
  410. this.Hide();
  411. }
  412. private void OnClickBtnRecommend()
  413. {
  414. if (this.currentListType == DressUpListType.List4)
  415. {
  416. this.hideListParts2();
  417. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  418. }
  419. EquipDataCache.cacher.TryCancelSuit(_currentSuitId);
  420. InstanceZonesDataManager.usedRecommend = true;
  421. EquipDataCache.cacher.PutOnRecommendItems();
  422. UpdateListPartsSelected();
  423. UpdateListSuitPartsSelected();
  424. }
  425. private void InitLists()
  426. {
  427. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  428. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  429. _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
  430. listType1X = _ui.m_comListType1.target.x;
  431. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width;
  432. //一级菜单
  433. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  434. }
  435. private void showListType1()
  436. {
  437. _currentList2 = null;
  438. currentListType = DressUpListType.List1;
  439. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length;
  440. GTween.To(_ui.target.width, listType1X, 0.5f)
  441. .SetTarget(_ui.m_comListType1.target)
  442. .OnUpdate((GTweener t) =>
  443. {
  444. _ui.m_comListType1.target.x = t.value.x;
  445. });
  446. }
  447. private void hideListType1()
  448. {
  449. GTween.To(listType1X, _ui.target.width, 0.5f)
  450. .SetTarget(_ui.m_comListType1.target)
  451. .OnUpdate((GTweener t) =>
  452. {
  453. _ui.m_comListType1.target.x = t.value.x;
  454. });
  455. }
  456. private void showListType2(int[] menuStrArr = null)
  457. {
  458. currentListType = DressUpListType.List2;
  459. if (menuStrArr != null && menuStrArr.Length > 0)
  460. {
  461. int len = menuStrArr.Length;
  462. _currentList2 = menuStrArr.Clone() as int[];
  463. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  464. _ui.m_comListType2.m_listType.numItems = len;
  465. //_ui.m_listType2.ResizeToFit(_ui.m_listType2.numItems);
  466. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  467. if (_ui.m_comListType2.m_listType.height > maxHeight)
  468. {
  469. _ui.m_comListType2.m_listType.height = maxHeight;
  470. }
  471. }
  472. GTween.To(_ui.target.width, listType1X, 0.5f)
  473. .SetTarget(_ui.m_comListType2.target)
  474. .OnUpdate((GTweener t) =>
  475. {
  476. _ui.m_comListType2.target.x = t.value.x;
  477. });
  478. }
  479. private void hideListType2()
  480. {
  481. GTween.To(listType1X, _ui.target.width, 0.5f)
  482. .SetTarget(_ui.m_comListType2.target)
  483. .OnUpdate((GTweener t) =>
  484. {
  485. _ui.m_comListType2.target.x = t.value.x;
  486. });
  487. }
  488. private bool showListParts(int type, bool selectItem = false)
  489. {
  490. _currentMenuType = type;
  491. UpdatePartsListSort();
  492. if (_ui.m_partsList.m_list.numItems <= 0) return false;
  493. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  494. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;
  495. if (_ui.m_partsList.m_list.height > maxHeight)
  496. {
  497. _ui.m_partsList.m_list.height = maxHeight;
  498. }
  499. if (selectItem)
  500. {
  501. int itemId = EquipDataCache.cacher.GetItemIdBuyType(_currentMenuType);
  502. if (itemId > 0)
  503. {
  504. int index = _currentList3.IndexOf(itemId);
  505. _ui.m_partsList.m_list.ScrollToView(index);
  506. }
  507. }
  508. currentListType = DressUpListType.List3;
  509. GTween.To(_ui.target.width, partsListX, 0.5f)
  510. .SetTarget(_ui.m_partsList)
  511. .OnUpdate((GTweener t) =>
  512. {
  513. _ui.m_partsList.target.x = t.value.x;
  514. });
  515. UpdateListPartsSelected();
  516. return true;
  517. }
  518. private void OnComboBoxRarityChanged()
  519. {
  520. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  521. this.UpdatePartsListSort();
  522. }
  523. private void UpdatePartsListSort()
  524. {
  525. if (_currentMenuType == 0) return;
  526. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  527. {
  528. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  529. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  530. {
  531. _currentList3 = SuitUtil.SortSuitListByHighScore(_currentList3);
  532. }
  533. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  534. {
  535. _currentList3 = SuitUtil.SortSuitListByLowScore(_currentList3);
  536. }
  537. else
  538. {
  539. _currentList3.Reverse();
  540. }
  541. }
  542. else
  543. {
  544. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  545. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  546. {
  547. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3);
  548. }
  549. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  550. {
  551. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3);
  552. }
  553. else
  554. {
  555. _currentList3.Reverse();
  556. }
  557. }
  558. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  559. {
  560. _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3, _currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG);
  561. }
  562. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  563. {
  564. _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3, _currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG);
  565. }
  566. //必穿品放在列表最前面
  567. if (_fightCfg.needItemId > 0)
  568. {
  569. int index = _currentList3.IndexOf(_fightCfg.needItemId);
  570. if (index >= 0)
  571. {
  572. int item = _currentList3[index];
  573. _currentList3.Remove(_currentList3[index]);
  574. _currentList3.Insert(0, item);
  575. }
  576. }
  577. else if (_fightCfg.needSuitId > 0)
  578. {
  579. int index = _currentList3.IndexOf(_fightCfg.needSuitId);
  580. if (index >= 0)
  581. {
  582. int item = _currentList3[index];
  583. _currentList3.Remove(_currentList3[index]);
  584. _currentList3.Insert(0, item);
  585. }
  586. }
  587. _ui.m_partsList.m_list.RemoveChildrenToPool();
  588. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  589. }
  590. private void UpdateSuitPartsListSort()
  591. {
  592. if (_currentMenuType == 0) return;
  593. _currentList4 = new List<int>(SuitCfgManager.Instance.GetSuitItems(_currentSuitId, true));
  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 hideListParts()
  606. {
  607. GTween.To(partsListX, _ui.target.width, 0.5f)
  608. .SetTarget(_ui.m_partsList)
  609. .OnUpdate((GTweener t) =>
  610. {
  611. _ui.m_partsList.target.x = t.value.x;
  612. });
  613. }
  614. private void showListParts2(int suitId)
  615. {
  616. _currentSuitId = suitId;
  617. _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  618. this.UpdateSuitPartsListSort();
  619. _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
  620. float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
  621. if (_ui.m_partsList2.m_list.height > maxHeight)
  622. {
  623. _ui.m_partsList2.m_list.height = maxHeight;
  624. }
  625. currentListType = DressUpListType.List4;
  626. GTween.To(_ui.target.width, partsListX, 0.5f)
  627. .SetTarget(_ui.m_partsList2)
  628. .OnUpdate((GTweener t) =>
  629. {
  630. _ui.m_partsList2.target.x = t.value.x;
  631. });
  632. }
  633. private void hideListParts2()
  634. {
  635. _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
  636. GTween.To(partsListX, _ui.target.width, 0.5f)
  637. .SetTarget(_ui.m_partsList2)
  638. .OnUpdate((GTweener t) =>
  639. {
  640. _ui.m_partsList2.target.x = t.value.x;
  641. });
  642. }
  643. private void ListType1Item(int index, GObject item)
  644. {
  645. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  646. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
  647. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
  648. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  649. typeItem.target.data = item1.id;
  650. typeItem.m_imgNeed.visible = ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, item1.id);
  651. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.id);
  652. UI_TypeItem.ProxyEnd();
  653. }
  654. private void ListType2Item(int index, GObject item)
  655. {
  656. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  657. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
  658. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
  659. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  660. typeItem.target.data = item2.id;
  661. var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  662. typeItem.m_imgNeed.visible = subType == item2.type;
  663. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.id);
  664. UI_TypeItem.ProxyEnd();
  665. }
  666. private void ListPartsItem(int index, GObject item)
  667. {
  668. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  669. int id = (int)_currentList3[index];
  670. string iconRes = "";
  671. string partName = "";
  672. string ext = "png";
  673. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  674. {
  675. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  676. iconRes = suitCfg.res;
  677. partName = suitCfg.name;
  678. listItem.m_iconSelected.visible = false;
  679. listItem.m_txtScore.text = "" + SuitUtil.GetSuitScore(id);
  680. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  681. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.rarity;
  682. listItem.m_imgNew.visible = false;
  683. }
  684. else
  685. {
  686. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  687. iconRes = itemCfg.res;
  688. partName = itemCfg.name;
  689. listItem.m_iconSelected.visible = EquipDataCache.cacher.CheckDressUpItemIsOn(id);
  690. listItem.m_txtScore.text = "" + DressUpMenuItemDataManager.GetItemScore(id);
  691. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  692. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  693. listItem.m_imgNew.visible = isNew;
  694. if (isNew)
  695. {
  696. ItemProxy.ReqSetItemRead(id).Coroutine();
  697. }
  698. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  699. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  700. }
  701. if (listItem.target.data == null)
  702. {
  703. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  704. longPressGesture.once = true;
  705. longPressGesture.onAction.Add(OnLongPress);
  706. _listLongPress.Add(longPressGesture);
  707. }
  708. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  709. listItem.m_ScoreType.url = "ui://CommonGame/kp_sx_" + _fightCfg.scoreType;
  710. listItem.m_txtTitle.text = partName;
  711. listItem.target.data = id;
  712. listItem.m_imgNeed.visible = _fightCfg.needItemId == id || _fightCfg.needSuitId == id;
  713. UI_PartsListItem.ProxyEnd();
  714. }
  715. private void ListParts2Item(int index, GObject item)
  716. {
  717. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  718. int id = (int)_currentList4[index];
  719. string iconRes = "";
  720. string partName = "";
  721. string ext = "png";
  722. if (listItem.target.data == null)
  723. {
  724. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  725. longPressGesture.once = true;
  726. longPressGesture.onAction.Add(OnLongPress);
  727. _listLongPress.Add(longPressGesture);
  728. }
  729. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  730. iconRes = itemCfg.res;
  731. partName = itemCfg.name;
  732. listItem.m_iconSelected.visible = EquipDataCache.cacher.CheckDressUpItemIsOn(id);
  733. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  734. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  735. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  736. listItem.m_ScoreType.visible = true;
  737. // int mainScore;
  738. // int mainValuel;
  739. // ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
  740. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + _fightCfg.scoreType);
  741. listItem.m_txtScore.text = "" + DressUpMenuItemDataManager.GetItemScore(id, _fightCfg.scoreType);
  742. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  743. listItem.m_txtTitle.text = partName;
  744. listItem.target.data = id;
  745. // listItem.m_txtScore.visible = false;
  746. //listItem.m_ScoreType.visible = true;
  747. listItem.m_imgNeed.visible = false;
  748. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  749. listItem.m_imgNew.visible = isNew;
  750. if (isNew)
  751. {
  752. ItemProxy.ReqSetItemRead(id).Coroutine();
  753. }
  754. UI_PartsListItem.ProxyEnd();
  755. }
  756. private void UpdateListPartsSelected()
  757. {
  758. int count = _ui.m_partsList.m_list.numChildren;
  759. int suitId = EquipDataCache.cacher.CheckCurDressIsSuit();
  760. for (int i = 0; i < count; i++)
  761. {
  762. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(i));
  763. int id = (int)listItem.target.data;
  764. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  765. {
  766. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  767. }
  768. else
  769. {
  770. bool isPutOn = EquipDataCache.cacher.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  771. bool isSuit = !DressUpMenuItemDataManager.CheckIsSceneType(id) && suitId > 0 && SuitCfgManager.Instance.GetItemSuitId(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  772. bool isSceneSuit = DressUpMenuItemDataManager.CheckIsSceneType(id) && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  773. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  774. }
  775. UI_PartsListItem.ProxyEnd();
  776. }
  777. }
  778. private void UpdateListSuitPartsSelected()
  779. {
  780. int count = _ui.m_partsList2.m_list.numChildren;
  781. int suitId = EquipDataCache.cacher.CheckCurDressIsSuit();
  782. for (int i = 0; i < count; i++)
  783. {
  784. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  785. int id = (int)listItem.target.data;
  786. bool isPutOn = EquipDataCache.cacher.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  787. bool isSuit = !DressUpMenuItemDataManager.CheckIsSceneType(id) && suitId > 0 && SuitCfgManager.Instance.GetItemSuitId(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  788. bool isSceneSuit = DressUpMenuItemDataManager.CheckIsSceneType(id) && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  789. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  790. UI_PartsListItem.ProxyEnd();
  791. }
  792. }
  793. private void ShowTaskHint()
  794. {
  795. _ui.m_groupTaskHint.visible = true;
  796. _ui.m_txtHint.text = _levelCfg.hint;
  797. if (this._ui.m_txtHint.textHeight > this._ui.m_txtHint.textFormat.size * 2)
  798. {
  799. this._ui.m_txtHint.align = AlignType.Left;
  800. }
  801. else
  802. {
  803. this._ui.m_txtHint.align = AlignType.Center;
  804. }
  805. }
  806. private void UpdateScore()
  807. {
  808. _ui.m_txtScore.text = "" + EquipDataCache.cacher.score;
  809. // GuideController.TryGuideDressUpFightViewBtnNext(_ui.m_btnNext);
  810. }
  811. private void OnClickBtnSearch()
  812. {
  813. ViewManager.Show<DressFilterView>(false, new object[] { ViewName.DRESS_UP_VIEW });
  814. }
  815. private void OnClickBtnAutoPlay()
  816. {
  817. EquipDataCache.cacher.autoPlay = _ui.m_btnAutoPlay.selected;
  818. }
  819. // private void OnClickBtnShow()
  820. // {
  821. // Timers.inst.Remove(SetBtnShowVisable);
  822. // _ui.m_c1.selectedIndex = 0;
  823. // _ui.m_btnHide.visible = true;
  824. // _ui.m_loaShow.visible = false;
  825. // _ui.m_btnShow.visible = false;
  826. // }
  827. // private void OnClickBtnHide()
  828. // {
  829. // _ui.m_c1.selectedIndex = 1;
  830. // _ui.m_btnHide.visible = false;
  831. // _ui.m_btnShow.visible = true;
  832. // _ui.m_loaShow.visible = true;
  833. // Timers.inst.Add(2f, 1, SetBtnShowVisable);
  834. // }
  835. // private void OnClickLoaShow()
  836. // {
  837. // Timers.inst.Remove(SetBtnShowVisable);
  838. // _ui.m_btnShow.alpha = 1;
  839. // Timers.inst.Add(2f, 1, SetBtnShowVisable);
  840. // _ui.m_btnShow.enabled = true;
  841. // }
  842. // private void SetBtnShowVisable(object param)
  843. // {
  844. // _ui.m_btnShow.enabled = false;
  845. // GTween.To(1, 0, 0.3f).SetTarget(_ui.m_btnShow, TweenPropType.Alpha);
  846. // }
  847. private void OnClickComNeed()
  848. {
  849. if (_fightCfg.needItemId <= 0 && _fightCfg.needSuitId <= 0)
  850. {
  851. return;
  852. }
  853. if (_fightCfg.needSuitId > 0)
  854. {
  855. ViewManager.Show(ViewName.SUIT_GUIDE_VIEW, new object[] { _ui.m_compNeed.target.data, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData } }, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData });
  856. }
  857. else
  858. {
  859. // ViewManager.Show(ViewName.APPROACH_OF_ITEM_VIEW, new object[] { _ui.m_compNeed.target.data, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData }, 1 });
  860. int itemId = (int)_ui.m_compNeed.target.data;
  861. object[] sourceDatas = new object[] { itemId, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData }, 1 };
  862. GoodsItemTipsController.ShowItemTips(itemId, sourceDatas);
  863. }
  864. }
  865. private void RenderListTagItem(int index, GObject obj)
  866. {
  867. UI.CommonGame.UI_ListTagItem item = UI.CommonGame.UI_ListTagItem.Proxy(obj);
  868. string tag = _fightCfg.needTagsArr[index];
  869. int tagType = TagCfgArray.Instance.GetCfg(tag).type;
  870. item.m_txtTag.text = tag;
  871. item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
  872. UI.CommonGame.UI_ListTagItem.ProxyEnd();
  873. }
  874. private bool CheckListCount(int type)
  875. {
  876. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  877. {
  878. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  879. }
  880. else
  881. {
  882. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  883. }
  884. }
  885. private void SendLog()
  886. {
  887. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  888. switch (levelCfg.type)
  889. {
  890. case ConstInstanceZonesType.Story:
  891. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.CHUN_ZHONG_LOU, 2);
  892. break;
  893. case ConstInstanceZonesType.Studio:
  894. StudioCfg studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
  895. if (studioCfg.funId == typeof(StudioMetalView).Name)
  896. {
  897. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 2);
  898. }
  899. else if (studioCfg.funId == typeof(StudioFabricView).Name)
  900. {
  901. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 2);
  902. }
  903. else if (studioCfg.funId == typeof(StudioPropertyView).Name)
  904. {
  905. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 2);
  906. }
  907. break;
  908. }
  909. }
  910. private void CheckGuide(object param)
  911. {
  912. if (GuideDataManager.IsGuideFinish(ConstGuideId.SINGLE_FIGHT) <= 0
  913. || GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0
  914. || GuideDataManager.IsGuideFinish(ConstGuideId.FIGHT_TIPS) <= 0)
  915. {
  916. UpdateToCheckGuide(null);
  917. }
  918. else
  919. {
  920. Timers.inst.Remove(CheckGuide);
  921. }
  922. }
  923. protected override void UpdateToCheckGuide(object param)
  924. {
  925. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  926. int syIndex = 0;
  927. int xzIndex = 0;
  928. int buyClothingIndex = 0;
  929. int buyClothingSubIndex = 0;
  930. int len = _ui.m_comListType1.m_listType.numChildren;
  931. for (int i = 0; i < len; i++)
  932. {
  933. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  934. if (item != null)
  935. {
  936. int menuID = (int)item.target.data;
  937. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  938. if (GuideDataManager.IsGuideFinish(ConstGuideId.SINGLE_FIGHT) <= 0 && dressUpMenuItemCfg1.type == ConstDressUpItemType.SHANG_YI)
  939. {
  940. syIndex = i;
  941. }
  942. if (GuideDataManager.IsGuideFinish(ConstGuideId.SINGLE_FIGHT) <= 0 && dressUpMenuItemCfg1.type == ConstDressUpItemType.XIA_ZHUANG)
  943. {
  944. xzIndex = i;
  945. }
  946. if (_fightCfg.needItemId > 0)
  947. {
  948. int type = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  949. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0 && ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, dressUpMenuItemCfg1.id))
  950. {
  951. buyClothingIndex = i;
  952. }
  953. }
  954. }
  955. UI_TypeItem.ProxyEnd();
  956. }
  957. int len1 = _ui.m_comListType2.m_listType.numChildren;
  958. for (int i = 0; i < len1; i++)
  959. {
  960. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType2.m_listType.GetChildAt(i));
  961. if (item != null)
  962. {
  963. int menuID = (int)item.target.data;
  964. DressUpMenuItemCfg2 dressUpMenuItemCfg2 = DressUpMenuItemCfg2Array.Instance.GetCfg(menuID);
  965. var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  966. if (subType == dressUpMenuItemCfg2.type)
  967. {
  968. buyClothingSubIndex = i;
  969. }
  970. }
  971. UI_TypeItem.ProxyEnd();
  972. }
  973. int djcId = 10476;//点绛唇Id
  974. int djcIndex = 0;
  975. int buyClothingIdIndex = 0;
  976. for (int i = 0; i < _currentList3.Count; i++)
  977. {
  978. if (_currentList3[i] == djcId)
  979. {
  980. djcIndex = i;
  981. }
  982. if (_fightCfg.needItemId > 0 && _currentList3[i] == _fightCfg.needItemId)
  983. {
  984. buyClothingIdIndex = i;
  985. }
  986. }
  987. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.SINGLE_FIGHT, 3, "点击相应的分类,可以快速找到服饰。", syIndex);
  988. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.SINGLE_FIGHT, 4, "", 0, true, (int)_ui.m_partsList.m_list.y);
  989. GuideController.TryGuide(_ui.m_btnGuide, ConstGuideId.SINGLE_FIGHT, 5, "", -1, true, 0, 0, 0, false);
  990. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.SINGLE_FIGHT, 6, "接下来把裙子也换上。", xzIndex);
  991. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.SINGLE_FIGHT, 7, "", 0, true, (int)_ui.m_partsList.m_list.y);
  992. GuideController.TryGuide(_ui.m_btnNext, ConstGuideId.SINGLE_FIGHT, 8, "穿着完毕,来验证一下,换上的服饰是否符合需求。");
  993. GuideController.TryGuide(_ui.m_compNeed.target, ConstGuideId.BUY_CLOTHING, 3, "当提示有“必需品”时,需要穿上对应物品才能通关。", -1, true, 170);
  994. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.BUY_CLOTHING, 7, "按照指示就可以找到必需品啦。", buyClothingIndex);
  995. GuideController.TryGuide(_ui.m_comListType2.m_listType, ConstGuideId.BUY_CLOTHING, 8, "", buyClothingSubIndex);
  996. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.BUY_CLOTHING, 9, "点击换上吧。", buyClothingIdIndex, true, 170);
  997. GuideController.TryCompleteGuide(ConstGuideId.BUY_CLOTHING, 9);
  998. GuideController.TryGuide(_ui.m_btnHint, ConstGuideId.FIGHT_TIPS, 1, "这次换装需要获得别人的认可呢。");
  999. GuideController.TryCompleteGuide(ConstGuideId.FIGHT_TIPS, 1);
  1000. }
  1001. }
  1002. }