DressUpFightView.cs 47 KB

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