DressUpFightView.cs 45 KB

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