DressUpFightView.cs 47 KB

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