DressUpFightView.cs 45 KB

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