DressUpFightView.cs 47 KB

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