DressUpFightView.cs 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120
  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, StartCalculateScore);
  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, StartCalculateScore);
  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. // StartCalculateScore();
  368. OnClickBtnPhotograph();
  369. }
  370. }
  371. private void OnClickBtnPhotograph()
  372. {
  373. Timers.inst.StartCoroutine(ScreenShotTex());
  374. }
  375. private IEnumerator ScreenShotTex()
  376. {
  377. ItemCfg bgItemCfg = ItemCfgArray.Instance.GetCfg(EquipDataCache.cacher.bgId);
  378. string bgName = string.Format(DressUpUtil.FORMAT_SPRITE_NAME, bgItemCfg.subType, 1);
  379. GameObject bg = _sceneObject.transform.Find(bgName).gameObject;
  380. bg.SetActive(false);
  381. Color backgroundColor = Camera.main.backgroundColor;
  382. Camera.main.backgroundColor = new Color(255, 255, 255, 0);
  383. GRoot.inst.visible = false;
  384. yield return new WaitForEndOfFrame();
  385. Rect rect = new Rect(0, 0, UnityEngine.Screen.width, UnityEngine.Screen.height);
  386. Texture2D tex = new Texture2D((int)rect.width, (int)rect.height, TextureFormat.ARGB32, false);//新建一个Texture2D对象
  387. tex.ReadPixels(rect, 0, 0);//读取像素,屏幕左下角为0点
  388. tex.Apply();//保存像素信息
  389. // EquipDataCache.cacher.nTexture = new NTexture(tex);
  390. GRoot.inst.visible = true;
  391. bg.SetActive(true);
  392. Camera.main.backgroundColor = backgroundColor;
  393. StartCalculateScore();
  394. }
  395. private void StartCalculateScore()
  396. {
  397. //不可移动代码位置
  398. bool hasFightTarget = _fightCfg.targetName != null && _fightCfg.targetName.Length > 0;
  399. if (_levelCfg.type == ConstInstanceZonesType.Field)
  400. {
  401. FieldFightDataManager.Instance.CurrentCardId = InstanceZonesDataManager.currentCardId;
  402. FieldFightDataManager.Instance.CurrentScoreType = InstanceZonesDataManager.currentScoreType;
  403. FieldFightDataManager.Instance.currentLevelCfgId = InstanceZonesDataManager.currentLevelCfgId;
  404. FieldFightDataManager.Instance.equipDatas = EquipDataCache.cacher.equipDatas;
  405. }
  406. if (hasFightTarget)
  407. {
  408. ViewManager.Show(ViewName.STORY_FIGHT_TARGET_VIEW);
  409. }
  410. else
  411. {
  412. ViewManager.Show(ViewName.STORY_FIGHT_SINGLE_VIEW);
  413. }
  414. this.Hide();
  415. }
  416. private void OnClickBtnRecommend()
  417. {
  418. if (this.currentListType == DressUpListType.List4)
  419. {
  420. this.hideListParts2();
  421. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  422. }
  423. EquipDataCache.cacher.TryCancelSuit(_currentSuitId);
  424. InstanceZonesDataManager.usedRecommend = true;
  425. EquipDataCache.cacher.PutOnRecommendItems();
  426. UpdateListPartsSelected();
  427. UpdateListSuitPartsSelected();
  428. }
  429. private void InitLists()
  430. {
  431. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  432. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  433. _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
  434. listType1X = _ui.m_comListType1.target.x;
  435. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width;
  436. //一级菜单
  437. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  438. }
  439. private void showListType1()
  440. {
  441. _currentList2 = null;
  442. currentListType = DressUpListType.List1;
  443. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length;
  444. GTween.To(_ui.target.width, listType1X, 0.5f)
  445. .SetTarget(_ui.m_comListType1.target)
  446. .OnUpdate((GTweener t) =>
  447. {
  448. _ui.m_comListType1.target.x = t.value.x;
  449. });
  450. }
  451. private void hideListType1()
  452. {
  453. GTween.To(listType1X, _ui.target.width, 0.5f)
  454. .SetTarget(_ui.m_comListType1.target)
  455. .OnUpdate((GTweener t) =>
  456. {
  457. _ui.m_comListType1.target.x = t.value.x;
  458. });
  459. }
  460. private void showListType2(int[] menuStrArr = null)
  461. {
  462. currentListType = DressUpListType.List2;
  463. if (menuStrArr != null && menuStrArr.Length > 0)
  464. {
  465. int len = menuStrArr.Length;
  466. _currentList2 = menuStrArr.Clone() as int[];
  467. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  468. _ui.m_comListType2.m_listType.numItems = len;
  469. //_ui.m_listType2.ResizeToFit(_ui.m_listType2.numItems);
  470. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  471. if (_ui.m_comListType2.m_listType.height > maxHeight)
  472. {
  473. _ui.m_comListType2.m_listType.height = maxHeight;
  474. }
  475. }
  476. GTween.To(_ui.target.width, listType1X, 0.5f)
  477. .SetTarget(_ui.m_comListType2.target)
  478. .OnUpdate((GTweener t) =>
  479. {
  480. _ui.m_comListType2.target.x = t.value.x;
  481. });
  482. }
  483. private void hideListType2()
  484. {
  485. GTween.To(listType1X, _ui.target.width, 0.5f)
  486. .SetTarget(_ui.m_comListType2.target)
  487. .OnUpdate((GTweener t) =>
  488. {
  489. _ui.m_comListType2.target.x = t.value.x;
  490. });
  491. }
  492. private bool showListParts(int type, bool selectItem = false)
  493. {
  494. _currentMenuType = type;
  495. UpdatePartsListSort();
  496. if (_ui.m_partsList.m_list.numItems <= 0) return false;
  497. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  498. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;
  499. if (_ui.m_partsList.m_list.height > maxHeight)
  500. {
  501. _ui.m_partsList.m_list.height = maxHeight;
  502. }
  503. if (selectItem)
  504. {
  505. int itemId = EquipDataCache.cacher.GetItemIdBuyType(_currentMenuType);
  506. if (itemId > 0)
  507. {
  508. int index = _currentList3.IndexOf(itemId);
  509. _ui.m_partsList.m_list.ScrollToView(index);
  510. }
  511. }
  512. currentListType = DressUpListType.List3;
  513. GTween.To(_ui.target.width, partsListX, 0.5f)
  514. .SetTarget(_ui.m_partsList)
  515. .OnUpdate((GTweener t) =>
  516. {
  517. _ui.m_partsList.target.x = t.value.x;
  518. });
  519. UpdateListPartsSelected();
  520. return true;
  521. }
  522. private void OnComboBoxRarityChanged()
  523. {
  524. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  525. this.UpdatePartsListSort();
  526. }
  527. private void UpdatePartsListSort()
  528. {
  529. if (_currentMenuType == 0) return;
  530. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  531. {
  532. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  533. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  534. {
  535. _currentList3 = SuitUtil.SortSuitListByHighScore(_currentList3);
  536. }
  537. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  538. {
  539. _currentList3 = SuitUtil.SortSuitListByLowScore(_currentList3);
  540. }
  541. else
  542. {
  543. _currentList3.Reverse();
  544. }
  545. }
  546. else
  547. {
  548. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  549. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  550. {
  551. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3);
  552. }
  553. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  554. {
  555. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3);
  556. }
  557. else
  558. {
  559. _currentList3.Reverse();
  560. }
  561. }
  562. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  563. {
  564. _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3, _currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG);
  565. }
  566. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  567. {
  568. _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3, _currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG);
  569. }
  570. //必穿品放在列表最前面
  571. if (_fightCfg.needItemId > 0)
  572. {
  573. int index = _currentList3.IndexOf(_fightCfg.needItemId);
  574. if (index >= 0)
  575. {
  576. int item = _currentList3[index];
  577. _currentList3.Remove(_currentList3[index]);
  578. _currentList3.Insert(0, item);
  579. }
  580. }
  581. else if (_fightCfg.needSuitId > 0)
  582. {
  583. int index = _currentList3.IndexOf(_fightCfg.needSuitId);
  584. if (index >= 0)
  585. {
  586. int item = _currentList3[index];
  587. _currentList3.Remove(_currentList3[index]);
  588. _currentList3.Insert(0, item);
  589. }
  590. }
  591. _ui.m_partsList.m_list.RemoveChildrenToPool();
  592. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  593. }
  594. private void UpdateSuitPartsListSort()
  595. {
  596. if (_currentMenuType == 0) return;
  597. _currentList4 = new List<int>(SuitCfgManager.Instance.GetSuitItems(_currentSuitId, true));
  598. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  599. {
  600. _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4, false);
  601. }
  602. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  603. {
  604. _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4, false);
  605. }
  606. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  607. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  608. }
  609. private void hideListParts()
  610. {
  611. GTween.To(partsListX, _ui.target.width, 0.5f)
  612. .SetTarget(_ui.m_partsList)
  613. .OnUpdate((GTweener t) =>
  614. {
  615. _ui.m_partsList.target.x = t.value.x;
  616. });
  617. }
  618. private void showListParts2(int suitId)
  619. {
  620. _currentSuitId = suitId;
  621. _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  622. this.UpdateSuitPartsListSort();
  623. _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
  624. float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
  625. if (_ui.m_partsList2.m_list.height > maxHeight)
  626. {
  627. _ui.m_partsList2.m_list.height = maxHeight;
  628. }
  629. currentListType = DressUpListType.List4;
  630. GTween.To(_ui.target.width, partsListX, 0.5f)
  631. .SetTarget(_ui.m_partsList2)
  632. .OnUpdate((GTweener t) =>
  633. {
  634. _ui.m_partsList2.target.x = t.value.x;
  635. });
  636. }
  637. private void hideListParts2()
  638. {
  639. _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
  640. GTween.To(partsListX, _ui.target.width, 0.5f)
  641. .SetTarget(_ui.m_partsList2)
  642. .OnUpdate((GTweener t) =>
  643. {
  644. _ui.m_partsList2.target.x = t.value.x;
  645. });
  646. }
  647. private void ListType1Item(int index, GObject item)
  648. {
  649. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  650. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
  651. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
  652. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  653. typeItem.target.data = item1.id;
  654. typeItem.m_imgNeed.visible = ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, item1.id);
  655. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.id);
  656. UI_TypeItem.ProxyEnd();
  657. }
  658. private void ListType2Item(int index, GObject item)
  659. {
  660. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  661. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
  662. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
  663. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  664. typeItem.target.data = item2.id;
  665. var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  666. typeItem.m_imgNeed.visible = subType == item2.type;
  667. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.id);
  668. UI_TypeItem.ProxyEnd();
  669. }
  670. private void ListPartsItem(int index, GObject item)
  671. {
  672. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  673. int id = (int)_currentList3[index];
  674. string iconRes = "";
  675. string partName = "";
  676. string ext = "png";
  677. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  678. {
  679. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  680. iconRes = suitCfg.res;
  681. partName = suitCfg.name;
  682. listItem.m_iconSelected.visible = false;
  683. listItem.m_txtScore.text = "" + SuitUtil.GetSuitScore(id);
  684. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  685. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.rarity;
  686. listItem.m_imgNew.visible = false;
  687. }
  688. else
  689. {
  690. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  691. iconRes = itemCfg.res;
  692. partName = itemCfg.name;
  693. listItem.m_iconSelected.visible = EquipDataCache.cacher.CheckDressUpItemIsOn(id);
  694. listItem.m_txtScore.text = "" + DressUpMenuItemDataManager.GetItemScore(id);
  695. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  696. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  697. listItem.m_imgNew.visible = isNew;
  698. if (isNew)
  699. {
  700. ItemProxy.ReqSetItemRead(id).Coroutine();
  701. }
  702. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  703. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  704. }
  705. if (listItem.target.data == null)
  706. {
  707. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  708. longPressGesture.once = true;
  709. longPressGesture.onAction.Add(OnLongPress);
  710. _listLongPress.Add(longPressGesture);
  711. }
  712. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  713. listItem.m_ScoreType.url = "ui://CommonGame/kp_sx_" + _fightCfg.scoreType;
  714. listItem.m_txtTitle.text = partName;
  715. listItem.target.data = id;
  716. listItem.m_imgNeed.visible = _fightCfg.needItemId == id || _fightCfg.needSuitId == id;
  717. UI_PartsListItem.ProxyEnd();
  718. }
  719. private void ListParts2Item(int index, GObject item)
  720. {
  721. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  722. int id = (int)_currentList4[index];
  723. string iconRes = "";
  724. string partName = "";
  725. string ext = "png";
  726. if (listItem.target.data == null)
  727. {
  728. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  729. longPressGesture.once = true;
  730. longPressGesture.onAction.Add(OnLongPress);
  731. _listLongPress.Add(longPressGesture);
  732. }
  733. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  734. iconRes = itemCfg.res;
  735. partName = itemCfg.name;
  736. listItem.m_iconSelected.visible = EquipDataCache.cacher.CheckDressUpItemIsOn(id);
  737. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  738. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  739. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  740. listItem.m_ScoreType.visible = true;
  741. // int mainScore;
  742. // int mainValuel;
  743. // ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
  744. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + _fightCfg.scoreType);
  745. listItem.m_txtScore.text = "" + DressUpMenuItemDataManager.GetItemScore(id, _fightCfg.scoreType);
  746. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  747. listItem.m_txtTitle.text = partName;
  748. listItem.target.data = id;
  749. // listItem.m_txtScore.visible = false;
  750. //listItem.m_ScoreType.visible = true;
  751. listItem.m_imgNeed.visible = false;
  752. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  753. listItem.m_imgNew.visible = isNew;
  754. if (isNew)
  755. {
  756. ItemProxy.ReqSetItemRead(id).Coroutine();
  757. }
  758. UI_PartsListItem.ProxyEnd();
  759. }
  760. private void UpdateListPartsSelected()
  761. {
  762. int count = _ui.m_partsList.m_list.numChildren;
  763. int suitId = EquipDataCache.cacher.CheckCurDressIsSuit();
  764. for (int i = 0; i < count; i++)
  765. {
  766. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(i));
  767. int id = (int)listItem.target.data;
  768. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  769. {
  770. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  771. }
  772. else
  773. {
  774. bool isPutOn = EquipDataCache.cacher.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  775. bool isSuit = !DressUpMenuItemDataManager.CheckIsSceneType(id) && suitId > 0 && SuitCfgManager.Instance.GetItemSuitId(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  776. bool isSceneSuit = DressUpMenuItemDataManager.CheckIsSceneType(id) && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  777. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  778. }
  779. UI_PartsListItem.ProxyEnd();
  780. }
  781. }
  782. private void UpdateListSuitPartsSelected()
  783. {
  784. int count = _ui.m_partsList2.m_list.numChildren;
  785. int suitId = EquipDataCache.cacher.CheckCurDressIsSuit();
  786. for (int i = 0; i < count; i++)
  787. {
  788. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  789. int id = (int)listItem.target.data;
  790. bool isPutOn = EquipDataCache.cacher.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  791. bool isSuit = !DressUpMenuItemDataManager.CheckIsSceneType(id) && suitId > 0 && SuitCfgManager.Instance.GetItemSuitId(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  792. bool isSceneSuit = DressUpMenuItemDataManager.CheckIsSceneType(id) && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  793. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  794. UI_PartsListItem.ProxyEnd();
  795. }
  796. }
  797. private void ShowTaskHint()
  798. {
  799. _ui.m_groupTaskHint.visible = true;
  800. _ui.m_txtHint.text = _levelCfg.hint;
  801. if (this._ui.m_txtHint.textHeight > this._ui.m_txtHint.textFormat.size * 2)
  802. {
  803. this._ui.m_txtHint.align = AlignType.Left;
  804. }
  805. else
  806. {
  807. this._ui.m_txtHint.align = AlignType.Center;
  808. }
  809. }
  810. private void UpdateScore()
  811. {
  812. _ui.m_txtScore.text = "" + EquipDataCache.cacher.score;
  813. // GuideController.TryGuideDressUpFightViewBtnNext(_ui.m_btnNext);
  814. }
  815. private void OnClickBtnSearch()
  816. {
  817. ViewManager.Show<DressFilterView>(false, new object[] { ViewName.DRESS_UP_VIEW });
  818. }
  819. private void OnClickBtnAutoPlay()
  820. {
  821. EquipDataCache.cacher.autoPlay = _ui.m_btnAutoPlay.selected;
  822. }
  823. // private void OnClickBtnShow()
  824. // {
  825. // Timers.inst.Remove(SetBtnShowVisable);
  826. // _ui.m_c1.selectedIndex = 0;
  827. // _ui.m_btnHide.visible = true;
  828. // _ui.m_loaShow.visible = false;
  829. // _ui.m_btnShow.visible = false;
  830. // }
  831. // private void OnClickBtnHide()
  832. // {
  833. // _ui.m_c1.selectedIndex = 1;
  834. // _ui.m_btnHide.visible = false;
  835. // _ui.m_btnShow.visible = true;
  836. // _ui.m_loaShow.visible = true;
  837. // Timers.inst.Add(2f, 1, SetBtnShowVisable);
  838. // }
  839. // private void OnClickLoaShow()
  840. // {
  841. // Timers.inst.Remove(SetBtnShowVisable);
  842. // _ui.m_btnShow.alpha = 1;
  843. // Timers.inst.Add(2f, 1, SetBtnShowVisable);
  844. // _ui.m_btnShow.enabled = true;
  845. // }
  846. // private void SetBtnShowVisable(object param)
  847. // {
  848. // _ui.m_btnShow.enabled = false;
  849. // GTween.To(1, 0, 0.3f).SetTarget(_ui.m_btnShow, TweenPropType.Alpha);
  850. // }
  851. private void OnClickComNeed()
  852. {
  853. if (_fightCfg.needItemId <= 0 && _fightCfg.needSuitId <= 0)
  854. {
  855. return;
  856. }
  857. if (_fightCfg.needSuitId > 0)
  858. {
  859. 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 });
  860. }
  861. else
  862. {
  863. // ViewManager.Show(ViewName.APPROACH_OF_ITEM_VIEW, new object[] { _ui.m_compNeed.target.data, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData }, 1 });
  864. int itemId = (int)_ui.m_compNeed.target.data;
  865. object[] sourceDatas = new object[] { itemId, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData }, 1 };
  866. GoodsItemTipsController.ShowItemTips(itemId, sourceDatas);
  867. }
  868. }
  869. private void RenderListTagItem(int index, GObject obj)
  870. {
  871. UI.CommonGame.UI_ListTagItem item = UI.CommonGame.UI_ListTagItem.Proxy(obj);
  872. string tag = _fightCfg.needTagsArr[index];
  873. int tagType = TagCfgArray.Instance.GetCfg(tag).type;
  874. item.m_txtTag.text = tag;
  875. item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
  876. UI.CommonGame.UI_ListTagItem.ProxyEnd();
  877. }
  878. private bool CheckListCount(int type)
  879. {
  880. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  881. {
  882. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  883. }
  884. else
  885. {
  886. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  887. }
  888. }
  889. private void SendLog()
  890. {
  891. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  892. switch (levelCfg.type)
  893. {
  894. case ConstInstanceZonesType.Story:
  895. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.CHUN_ZHONG_LOU, 2);
  896. break;
  897. case ConstInstanceZonesType.Studio:
  898. StudioCfg studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
  899. if (studioCfg.funId == typeof(StudioMetalView).Name)
  900. {
  901. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 2);
  902. }
  903. else if (studioCfg.funId == typeof(StudioFabricView).Name)
  904. {
  905. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 2);
  906. }
  907. else if (studioCfg.funId == typeof(StudioPropertyView).Name)
  908. {
  909. LogServerHelper.SendNodeLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 2);
  910. }
  911. break;
  912. }
  913. }
  914. private void CheckGuide(object param)
  915. {
  916. if (GuideDataManager.IsGuideFinish(ConstGuideId.SINGLE_FIGHT) <= 0
  917. || GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0
  918. || GuideDataManager.IsGuideFinish(ConstGuideId.FIGHT_TIPS) <= 0)
  919. {
  920. UpdateToCheckGuide(null);
  921. }
  922. else
  923. {
  924. Timers.inst.Remove(CheckGuide);
  925. }
  926. }
  927. protected override void UpdateToCheckGuide(object param)
  928. {
  929. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  930. int syIndex = 0;
  931. int xzIndex = 0;
  932. int buyClothingIndex = 0;
  933. int buyClothingSubIndex = 0;
  934. int len = _ui.m_comListType1.m_listType.numChildren;
  935. for (int i = 0; i < len; i++)
  936. {
  937. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  938. if (item != null)
  939. {
  940. int menuID = (int)item.target.data;
  941. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  942. if (GuideDataManager.IsGuideFinish(ConstGuideId.SINGLE_FIGHT) <= 0 && dressUpMenuItemCfg1.type == ConstDressUpItemType.SHANG_YI)
  943. {
  944. syIndex = i;
  945. }
  946. if (GuideDataManager.IsGuideFinish(ConstGuideId.SINGLE_FIGHT) <= 0 && dressUpMenuItemCfg1.type == ConstDressUpItemType.XIA_ZHUANG)
  947. {
  948. xzIndex = i;
  949. }
  950. if (_fightCfg.needItemId > 0)
  951. {
  952. int type = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  953. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0 && ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, dressUpMenuItemCfg1.id))
  954. {
  955. buyClothingIndex = i;
  956. }
  957. }
  958. }
  959. UI_TypeItem.ProxyEnd();
  960. }
  961. int len1 = _ui.m_comListType2.m_listType.numChildren;
  962. for (int i = 0; i < len1; i++)
  963. {
  964. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType2.m_listType.GetChildAt(i));
  965. if (item != null)
  966. {
  967. int menuID = (int)item.target.data;
  968. DressUpMenuItemCfg2 dressUpMenuItemCfg2 = DressUpMenuItemCfg2Array.Instance.GetCfg(menuID);
  969. var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  970. if (subType == dressUpMenuItemCfg2.type)
  971. {
  972. buyClothingSubIndex = i;
  973. }
  974. }
  975. UI_TypeItem.ProxyEnd();
  976. }
  977. int djcId = 10476;//点绛唇Id
  978. int djcIndex = 0;
  979. int buyClothingIdIndex = 0;
  980. for (int i = 0; i < _currentList3.Count; i++)
  981. {
  982. if (_currentList3[i] == djcId)
  983. {
  984. djcIndex = i;
  985. }
  986. if (_fightCfg.needItemId > 0 && _currentList3[i] == _fightCfg.needItemId)
  987. {
  988. buyClothingIdIndex = i;
  989. }
  990. }
  991. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.SINGLE_FIGHT, 3, "点击相应的分类,可以快速找到服饰。", syIndex);
  992. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.SINGLE_FIGHT, 4, "", 0, true, (int)_ui.m_partsList.m_list.y);
  993. GuideController.TryGuide(_ui.m_btnGuide, ConstGuideId.SINGLE_FIGHT, 5, "", -1, true, 0, 0, 0, false);
  994. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.SINGLE_FIGHT, 6, "接下来把裙子也换上。", xzIndex);
  995. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.SINGLE_FIGHT, 7, "", 0, true, (int)_ui.m_partsList.m_list.y);
  996. GuideController.TryGuide(_ui.m_btnNext, ConstGuideId.SINGLE_FIGHT, 8, "穿着完毕,来验证一下,换上的服饰是否符合需求。");
  997. GuideController.TryGuide(_ui.m_compNeed.target, ConstGuideId.BUY_CLOTHING, 3, "当提示有“必需品”时,需要穿上对应物品才能通关。", -1, true, 170);
  998. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.BUY_CLOTHING, 7, "按照指示就可以找到必需品啦。", buyClothingIndex);
  999. GuideController.TryGuide(_ui.m_comListType2.m_listType, ConstGuideId.BUY_CLOTHING, 8, "", buyClothingSubIndex);
  1000. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.BUY_CLOTHING, 9, "点击换上吧。", buyClothingIdIndex, true, 170);
  1001. GuideController.TryCompleteGuide(ConstGuideId.BUY_CLOTHING, 9);
  1002. GuideController.TryGuide(_ui.m_btnHint, ConstGuideId.FIGHT_TIPS, 1, "这次换装需要获得别人的认可呢。");
  1003. GuideController.TryCompleteGuide(ConstGuideId.FIGHT_TIPS, 1);
  1004. }
  1005. }
  1006. }