DressUpFightView.cs 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121
  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. UpdateListPartsSelected();
  374. UpdateListSuitPartsSelected();
  375. }
  376. private void OnClickBtnClose()
  377. {
  378. _ui.m_btnClose.visible = false;
  379. _ui.m_grpTips.visible = false;
  380. }
  381. private void OnClickBtnNext()
  382. {
  383. if (!MyDressUpHelper.CheckPutOnFinish())
  384. {
  385. AlertUI.Show("只有换好衣服才能出门哦!")
  386. .SetRightButton(true, "好的");
  387. return;
  388. }
  389. if (!CheckHasNeed())
  390. {
  391. AlertUI.Show("未穿戴必需品。").SetRightButton(true, "好的");
  392. return;
  393. }
  394. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  395. if (RoleDataManager.power < levelCfg.power)
  396. {
  397. ItemUtil.AddPower("体力不足", OnClickBtnPhotograph);
  398. return;
  399. }
  400. OnClickBtnPhotograph();
  401. }
  402. private bool CheckHasNeed()
  403. {
  404. int _suitId = MyDressUpHelper.dressUpObj.suitId;
  405. bool isNoSuit = _fightCfg.needSuitId > 0 && _suitId != _fightCfg.needSuitId;//需要套装但未穿套装
  406. bool isDressUpItem = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(_fightCfg.needItemId);
  407. bool isIncludeItem = _suitId > 0 && Array.IndexOf(SuitCfgArray.Instance.GetCfg(_suitId).partsArr, _fightCfg.needItemId) >= 0;
  408. bool isNoItem = _fightCfg.needItemId > 0 && !isDressUpItem && !isIncludeItem;
  409. if (isNoSuit || isNoItem)
  410. {
  411. return false;
  412. }
  413. return true;
  414. }
  415. private void OnClickBtnPhotograph()
  416. {
  417. Timers.inst.StartCoroutine(ScreenShotTex());
  418. }
  419. private IEnumerator ScreenShotTex()
  420. {
  421. GameObject Role = _sceneObject.transform.Find("Role").gameObject;
  422. GameObject CopyRoleParent = _sceneObject.transform.Find("CopyRole").gameObject;
  423. Transform CopyRole = CopyRoleParent.transform.Find("Role");
  424. if (CopyRole != null)
  425. {
  426. GameObject.DestroyImmediate(CopyRole.gameObject);
  427. }
  428. Transform transform = GameObject.Instantiate(Role, CopyRoleParent.transform.position, Quaternion.identity).transform;//实例化物体
  429. transform.parent = CopyRoleParent.transform;
  430. transform.name = "Role";
  431. GameObject gameObject = _sceneObject.transform.Find("FightCamera").gameObject;
  432. Camera camera = gameObject.GetComponent<Camera>();
  433. FightDataManager.Instance.RoleTextuex = FightDataManager.Instance.GetPrintscreenNTexture(camera);
  434. yield return new WaitForEndOfFrame();
  435. if (CardDataManager.GetCardListByRarity(0).Count > 0)
  436. {
  437. ViewManager.Show<StoryCardChoose>(_fightCfg.scoreType);
  438. }
  439. else
  440. {
  441. StartCalculateScore();
  442. }
  443. }
  444. private void StartCalculateScore()
  445. {
  446. //不可移动代码位置
  447. bool hasFightTarget = _fightCfg.targetName != null && _fightCfg.targetName.Length > 0;
  448. if (_levelCfg.type == ConstInstanceZonesType.Field)
  449. {
  450. FieldFightDataManager.Instance.CurrentCardId = InstanceZonesDataManager.currentCardId;
  451. FieldFightDataManager.Instance.CurrentScoreType = InstanceZonesDataManager.currentScoreType;
  452. FieldFightDataManager.Instance.currentLevelCfgId = InstanceZonesDataManager.currentLevelCfgId;
  453. }
  454. if (hasFightTarget)
  455. {
  456. ViewManager.Show(ViewName.STORY_FIGHT_TARGET_VIEW);
  457. }
  458. else
  459. {
  460. ViewManager.Show(ViewName.STORY_FIGHT_SINGLE_VIEW);
  461. }
  462. this.Hide();
  463. }
  464. private void OnClickBtnRecommend()
  465. {
  466. if (this.currentListType == DressUpListType.List4)
  467. {
  468. this.hideListParts2();
  469. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  470. }
  471. MyDressUpHelper.dressUpObj.CheckCancelActionWhenPutOn(_currentSuitId);
  472. InstanceZonesDataManager.usedRecommend = true;
  473. // MyDressUpHelper.PutOnRecommendItems();
  474. MyDressUpHelper.PutOnRecommendItems2();
  475. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  476. UpdateListPartsSelected();
  477. UpdateListSuitPartsSelected();
  478. UpdateScore();
  479. if (!CheckHasNeed())
  480. {
  481. PromptController.Instance.ShowFloatTextPrompt("未拥有必需品");
  482. }
  483. }
  484. private void InitLists()
  485. {
  486. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  487. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  488. _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
  489. listType1X = _ui.m_comListType1.target.x;
  490. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width;
  491. //一级菜单
  492. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  493. }
  494. private void showListType1()
  495. {
  496. _currentList2 = null;
  497. currentListType = DressUpListType.List1;
  498. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
  499. GTween.To(_ui.target.width, listType1X, 0.5f)
  500. .SetTarget(_ui.m_comListType1.target)
  501. .OnUpdate((GTweener t) =>
  502. {
  503. _ui.m_comListType1.target.x = t.value.x;
  504. });
  505. }
  506. private void hideListType1()
  507. {
  508. GTween.To(listType1X, _ui.target.width, 0.5f)
  509. .SetTarget(_ui.m_comListType1.target)
  510. .OnUpdate((GTweener t) =>
  511. {
  512. _ui.m_comListType1.target.x = t.value.x;
  513. });
  514. }
  515. private void showListType2(int[] menuStrArr = null)
  516. {
  517. currentListType = DressUpListType.List2;
  518. if (menuStrArr != null && menuStrArr.Length > 0)
  519. {
  520. int len = menuStrArr.Length;
  521. _currentList2 = menuStrArr.Clone() as int[];
  522. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  523. _ui.m_comListType2.m_listType.numItems = len;
  524. //_ui.m_listType2.ResizeToFit(_ui.m_listType2.numItems);
  525. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  526. if (_ui.m_comListType2.m_listType.height > maxHeight)
  527. {
  528. _ui.m_comListType2.m_listType.height = maxHeight;
  529. }
  530. }
  531. GTween.To(_ui.target.width, listType1X, 0.5f)
  532. .SetTarget(_ui.m_comListType2.target)
  533. .OnUpdate((GTweener t) =>
  534. {
  535. _ui.m_comListType2.target.x = t.value.x;
  536. });
  537. }
  538. private void hideListType2()
  539. {
  540. GTween.To(listType1X, _ui.target.width, 0.5f)
  541. .SetTarget(_ui.m_comListType2.target)
  542. .OnUpdate((GTweener t) =>
  543. {
  544. _ui.m_comListType2.target.x = t.value.x;
  545. });
  546. }
  547. private bool showListParts(int type, bool selectItem = false)
  548. {
  549. _currentMenuType = type;
  550. UpdatePartsListSort();
  551. if (_ui.m_partsList.m_list.numItems <= 0) return false;
  552. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  553. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;
  554. if (_ui.m_partsList.m_list.height > maxHeight)
  555. {
  556. _ui.m_partsList.m_list.height = maxHeight;
  557. }
  558. if (selectItem)
  559. {
  560. int itemId = MyDressUpHelper.dressUpObj.GetItemIdBuyType(_currentMenuType);
  561. if (itemId > 0)
  562. {
  563. int index = _currentList3.IndexOf(itemId);
  564. if (index >= 0 && index < _ui.m_partsList.m_list.numItems)
  565. {
  566. _ui.m_partsList.m_list.ScrollToView(index);
  567. }
  568. }
  569. }
  570. currentListType = DressUpListType.List3;
  571. GTween.To(_ui.target.width, partsListX, 0.5f)
  572. .SetTarget(_ui.m_partsList)
  573. .OnUpdate((GTweener t) =>
  574. {
  575. _ui.m_partsList.target.x = t.value.x;
  576. });
  577. UpdateListPartsSelected();
  578. return true;
  579. }
  580. private void OnComboBoxRarityChanged()
  581. {
  582. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  583. this.UpdatePartsListSort();
  584. }
  585. private void UpdatePartsListSort()
  586. {
  587. if (_currentMenuType == 0) return;
  588. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  589. {
  590. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  591. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  592. {
  593. _currentList3 = SuitUtil.SortSuitListByHighScore(_currentList3);
  594. }
  595. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  596. {
  597. _currentList3 = SuitUtil.SortSuitListByLowScore(_currentList3);
  598. }
  599. else
  600. {
  601. _currentList3.Reverse();
  602. }
  603. }
  604. else
  605. {
  606. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  607. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  608. {
  609. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3);
  610. }
  611. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  612. {
  613. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3);
  614. }
  615. else
  616. {
  617. _currentList3.Reverse();
  618. }
  619. }
  620. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  621. {
  622. _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
  623. }
  624. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  625. {
  626. _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
  627. }
  628. //必穿品放在列表最前面
  629. if (_fightCfg.needItemId > 0)
  630. {
  631. int index = _currentList3.IndexOf(_fightCfg.needItemId);
  632. if (index >= 0)
  633. {
  634. int item = _currentList3[index];
  635. _currentList3.Remove(_currentList3[index]);
  636. _currentList3.Insert(0, item);
  637. }
  638. }
  639. else if (_fightCfg.needSuitId > 0)
  640. {
  641. int index = _currentList3.IndexOf(_fightCfg.needSuitId);
  642. if (index >= 0)
  643. {
  644. int item = _currentList3[index];
  645. _currentList3.Remove(_currentList3[index]);
  646. _currentList3.Insert(0, item);
  647. }
  648. }
  649. _ui.m_partsList.m_list.RemoveChildrenToPool();
  650. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  651. }
  652. private void UpdateSuitPartsListSort()
  653. {
  654. if (_currentMenuType == 0) return;
  655. _currentList4 = new List<int>(SuitCfgArray.Instance.GetSuitItems(_currentSuitId, true));
  656. if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  657. {
  658. _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4);
  659. }
  660. else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  661. {
  662. _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4);
  663. }
  664. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  665. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  666. }
  667. private void hideListParts()
  668. {
  669. GTween.To(partsListX, _ui.target.width, 0.5f)
  670. .SetTarget(_ui.m_partsList)
  671. .OnUpdate((GTweener t) =>
  672. {
  673. _ui.m_partsList.target.x = t.value.x;
  674. });
  675. }
  676. private void showListParts2(int suitId)
  677. {
  678. _currentSuitId = suitId;
  679. _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  680. this.UpdateSuitPartsListSort();
  681. _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
  682. float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
  683. if (_ui.m_partsList2.m_list.height > maxHeight)
  684. {
  685. _ui.m_partsList2.m_list.height = maxHeight;
  686. }
  687. currentListType = DressUpListType.List4;
  688. GTween.To(_ui.target.width, partsListX, 0.5f)
  689. .SetTarget(_ui.m_partsList2)
  690. .OnUpdate((GTweener t) =>
  691. {
  692. _ui.m_partsList2.target.x = t.value.x;
  693. });
  694. }
  695. private void hideListParts2()
  696. {
  697. _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
  698. GTween.To(partsListX, _ui.target.width, 0.5f)
  699. .SetTarget(_ui.m_partsList2)
  700. .OnUpdate((GTweener t) =>
  701. {
  702. _ui.m_partsList2.target.x = t.value.x;
  703. });
  704. }
  705. private void ListType1Item(int index, GObject item)
  706. {
  707. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  708. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
  709. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
  710. typeItem.m_txtname.text = item1.name;
  711. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  712. typeItem.target.data = item1.id;
  713. typeItem.m_imgNeed.visible = ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, item1.id);
  714. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.id);
  715. UI_TypeItem.ProxyEnd();
  716. }
  717. private void ListType2Item(int index, GObject item)
  718. {
  719. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  720. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
  721. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
  722. typeItem.m_txtname.text = item2.name;
  723. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  724. typeItem.target.data = item2.id;
  725. var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  726. typeItem.m_imgNeed.visible = subType == item2.type;
  727. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.id);
  728. UI_TypeItem.ProxyEnd();
  729. }
  730. private void ListPartsItem(int index, GObject item)
  731. {
  732. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  733. int id = (int)_currentList3[index];
  734. string iconRes = "";
  735. string partName = "";
  736. string ext = "png";
  737. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  738. {
  739. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  740. iconRes = suitCfg.res;
  741. partName = suitCfg.name;
  742. listItem.m_iconSelected.visible = false;
  743. listItem.m_txtScore.text = "" + SuitUtil.GetSuitScore(id);
  744. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  745. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.rarity;
  746. listItem.m_imgNew.visible = false;
  747. }
  748. else
  749. {
  750. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  751. iconRes = itemCfg.res;
  752. partName = itemCfg.name;
  753. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  754. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _fightCfg.needTagsArr);
  755. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  756. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  757. listItem.m_imgNew.visible = isNew;
  758. if (isNew)
  759. {
  760. ItemProxy.ReqSetItemRead(id).Coroutine();
  761. }
  762. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  763. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  764. }
  765. if (listItem.target.data == null)
  766. {
  767. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  768. longPressGesture.once = true;
  769. longPressGesture.onAction.Add(OnLongPress);
  770. _listLongPress.Add(longPressGesture);
  771. }
  772. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  773. listItem.m_ScoreType.url = "ui://CommonGame/kp_sx_" + _fightCfg.scoreType;
  774. listItem.m_txtTitle.text = partName;
  775. listItem.target.data = id;
  776. listItem.m_imgNeed.visible = _fightCfg.needItemId == id || _fightCfg.needSuitId == id;
  777. UI_PartsListItem.ProxyEnd();
  778. }
  779. private void ListParts2Item(int index, GObject item)
  780. {
  781. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  782. int id = (int)_currentList4[index];
  783. string iconRes = "";
  784. string partName = "";
  785. string ext = "png";
  786. if (listItem.target.data == null)
  787. {
  788. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  789. longPressGesture.once = true;
  790. longPressGesture.onAction.Add(OnLongPress);
  791. _listLongPress.Add(longPressGesture);
  792. }
  793. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  794. iconRes = itemCfg.res;
  795. partName = itemCfg.name;
  796. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  797. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  798. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  799. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  800. listItem.m_ScoreType.visible = true;
  801. // int mainScore;
  802. // int mainValuel;
  803. // ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
  804. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + _fightCfg.scoreType);
  805. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, _fightCfg.scoreType, _fightCfg.needTagsArr);
  806. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  807. listItem.m_txtTitle.text = partName;
  808. listItem.target.data = id;
  809. // listItem.m_txtScore.visible = false;
  810. //listItem.m_ScoreType.visible = true;
  811. listItem.m_imgNeed.visible = false;
  812. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  813. listItem.m_imgNew.visible = isNew;
  814. if (isNew)
  815. {
  816. ItemProxy.ReqSetItemRead(id).Coroutine();
  817. }
  818. UI_PartsListItem.ProxyEnd();
  819. }
  820. private void UpdateListPartsSelected()
  821. {
  822. int count = _ui.m_partsList.m_list.numChildren;
  823. int suitId = MyDressUpHelper.dressUpObj.suitId;
  824. for (int i = 0; i < count; i++)
  825. {
  826. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(i));
  827. int id = (int)listItem.target.data;
  828. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  829. {
  830. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  831. }
  832. else
  833. {
  834. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  835. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  836. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  837. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  838. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  839. }
  840. UI_PartsListItem.ProxyEnd();
  841. }
  842. }
  843. private void UpdateListSuitPartsSelected()
  844. {
  845. int count = _ui.m_partsList2.m_list.numChildren;
  846. int suitId = MyDressUpHelper.dressUpObj.suitId;
  847. for (int i = 0; i < count; i++)
  848. {
  849. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  850. int id = (int)listItem.target.data;
  851. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  852. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  853. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  854. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  855. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  856. UI_PartsListItem.ProxyEnd();
  857. }
  858. }
  859. private void ShowTaskHint()
  860. {
  861. _ui.m_btnClose.visible = true;
  862. _ui.m_grpTips.visible = true;
  863. _ui.m_txtHint.text = _levelCfg.hint;
  864. if (this._ui.m_txtHint.textHeight > this._ui.m_txtHint.textFormat.size * 2)
  865. {
  866. this._ui.m_txtHint.align = AlignType.Left;
  867. }
  868. else
  869. {
  870. this._ui.m_txtHint.align = AlignType.Center;
  871. }
  872. }
  873. private void UpdateScore()
  874. {
  875. _ui.m_txtScore.text = "" + FightDataManager.Instance.GetScore(InstanceZonesDataManager.roleData).ToString();
  876. // GuideController.TryGuideDressUpFightViewBtnNext(_ui.m_btnNext);
  877. }
  878. private void OnClickBtnSearch()
  879. {
  880. ViewManager.Show<DressFilterView>(false, new object[] { ViewName.DRESS_UP_VIEW });
  881. }
  882. private void OnClickBtnAutoPlay()
  883. {
  884. FightDataManager.Instance.autoPlay = _ui.m_btnAutoPlay.selected;
  885. }
  886. private void OnClickComNeed()
  887. {
  888. if (_fightCfg.needItemId <= 0 && _fightCfg.needSuitId <= 0)
  889. {
  890. return;
  891. }
  892. if (_fightCfg.needSuitId > 0)
  893. {
  894. ViewManager.Show<SuitPartsDetailView>(_fightCfg.needSuitId, new object[] { typeof(DressUpFightView).FullName, this.viewData });
  895. }
  896. else
  897. {
  898. int itemId = (int)_ui.m_compNeed.target.data;
  899. object[] sourceDatas = new object[] { itemId, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData }, 1 };
  900. GoodsItemTipsController.ShowItemTips(itemId, sourceDatas);
  901. }
  902. }
  903. private void RenderListTagItem(int index, GObject obj)
  904. {
  905. UI.CommonGame.UI_ComTag item = UI.CommonGame.UI_ComTag.Proxy(obj);
  906. string tag = _fightCfg.needTagsArr[index];
  907. int tagType = TagCfgArray.Instance.GetCfg(tag).type;
  908. item.m_txtTag.text = tag;
  909. item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
  910. UI.CommonGame.UI_ComTag.ProxyEnd();
  911. }
  912. private bool CheckListCount(int type)
  913. {
  914. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  915. {
  916. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  917. }
  918. else
  919. {
  920. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  921. }
  922. }
  923. private void SendLog()
  924. {
  925. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  926. switch (levelCfg.type)
  927. {
  928. case ConstInstanceZonesType.Story:
  929. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CHUN_ZHONG_LOU, 2);
  930. break;
  931. case ConstInstanceZonesType.Studio:
  932. StudioCfg studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
  933. if (studioCfg.funId == typeof(StudioMetalView).Name)
  934. {
  935. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 2);
  936. }
  937. else if (studioCfg.funId == typeof(StudioFabricView).Name)
  938. {
  939. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 2);
  940. }
  941. else if (studioCfg.funId == typeof(StudioPropertyView).Name)
  942. {
  943. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 2);
  944. }
  945. break;
  946. }
  947. }
  948. private void CheckGuide(object param)
  949. {
  950. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0
  951. || GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0
  952. || GuideDataManager.IsGuideFinish(ConstGuideId.AUTOPLAY_FIGHT) <= 0)
  953. {
  954. UpdateToCheckGuide(null);
  955. }
  956. else
  957. {
  958. Timers.inst.Remove(CheckGuide);
  959. }
  960. _ui.m_loaGuide.visible = false;
  961. }
  962. protected override void UpdateToCheckGuide(object param)
  963. {
  964. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  965. int buyClothingIndex = 0;
  966. int buyClothingSubIndex = 0;
  967. int taozhuangIndex = 0;
  968. int len = _ui.m_comListType1.m_listType.numChildren;
  969. for (int i = 0; i < len; i++)
  970. {
  971. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  972. if (item != null)
  973. {
  974. int menuID = (int)item.target.data;
  975. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  976. if (GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0 && dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  977. {
  978. taozhuangIndex = i;
  979. break;
  980. }
  981. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0 && _fightCfg.needItemId > 0 && ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, dressUpMenuItemCfg1.id))
  982. {
  983. buyClothingIndex = i;
  984. break;
  985. }
  986. }
  987. UI_TypeItem.ProxyEnd();
  988. }
  989. buyClothingSubIndex = _currentList3.IndexOf(_fightCfg.needItemId);
  990. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.START_FIGHT, 3, "点击相应的分类,可以快速找到服饰。", taozhuangIndex);
  991. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.START_FIGHT, 4, "", 0);
  992. GuideController.TryGuide(_ui.m_btnNext, ConstGuideId.START_FIGHT, 5, "穿着完毕,来验证一下,换上的服饰是否符合需求。");
  993. // GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
  994. GuideController.TryGuide(_ui.m_compNeed.target, ConstGuideId.BUY_CLOTHING, 3, "当提示有“必需品”时,需要穿上对应物品才能通关。");
  995. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.BUY_CLOTHING, 7, "按照指示就可以找到必需品啦,点击换上吧。", buyClothingIndex);
  996. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.BUY_CLOTHING, 8, "", buyClothingSubIndex);
  997. GuideController.TryCompleteGuide(ConstGuideId.BUY_CLOTHING, 8);
  998. GuideController.TryGuide(_ui.m_btnHint, ConstGuideId.FIGHT_TIPS, 1, "这次换装需要获得别人的认可呢。");
  999. GuideController.TryCompleteGuide(ConstGuideId.FIGHT_TIPS, 1);
  1000. GuideController.TryGuide(_ui.m_btnRecommend, ConstGuideId.AUTOPLAY_FIGHT, 1, "衣服太多难以选择,可以点击这里。");
  1001. GuideController.TryGuide(_ui.m_btnAutoPlay, ConstGuideId.AUTOPLAY_FIGHT, 2, "勾选后,自动进行比拼哦~~");
  1002. GuideController.TryCompleteGuide(ConstGuideId.AUTOPLAY_FIGHT, 2);
  1003. }
  1004. protected override void TryCompleteGuide()
  1005. {
  1006. base.TryCompleteGuide();
  1007. GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
  1008. }
  1009. }
  1010. }