DressUpFightView.cs 47 KB

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