DressUpFightView.cs 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487
  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 DressUpFightType
  11. {
  12. public int levelID;
  13. public int teaPartID;
  14. }
  15. public class DressUpFightView : BaseView
  16. {
  17. private UI_DressUpFightUI _ui;
  18. private int _fightID;
  19. private int _levelID;
  20. private int _TeaPartyID;
  21. private float listType1X = 0;
  22. private float partsListX = 0;
  23. private float partsListScrollingPosY = 0;
  24. private DressUpListType currentListType;
  25. private int[] _currentList2;
  26. private GameObject _scenePrefab;
  27. private GameObject _sceneObject;
  28. private List<int> _currentList3 = new List<int>();
  29. private List<int> _currentList4 = new List<int>();
  30. private int _currentMenuType;
  31. private int _currentSuitId;
  32. private StoryLevelCfg _levelCfg;
  33. private StoryFightCfg _fightCfg;
  34. private int scoreType = 0; //目标分数类型保存
  35. private bool IsTeaPart = false;
  36. private const int SORT_BY_HIGH_SCORE = 0;
  37. private const int SORT_BY_LOW_SCORE = 1;
  38. private int _scoreIndex = SORT_BY_HIGH_SCORE;
  39. private List<LongPressGesture> _listLongPress = new List<LongPressGesture>();
  40. public override void Dispose()
  41. {
  42. if (_sceneObject != null)
  43. {
  44. GameObject.Destroy(_sceneObject);
  45. _sceneObject = null;
  46. }
  47. for (int i = 0; i < _listLongPress.Count; i++)
  48. {
  49. _listLongPress[i].Dispose();
  50. }
  51. if (_ui != null)
  52. {
  53. _ui.Dispose();
  54. _ui = null;
  55. }
  56. base.Dispose();
  57. }
  58. protected override void OnInit()
  59. {
  60. base.OnInit();
  61. packageName = UI_DressUpFightUI.PACKAGE_NAME;
  62. _ui = UI_DressUpFightUI.Create();
  63. viewCom = _ui.target;
  64. isfullScreen = true;
  65. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneDressUpFight"));
  66. _ui.m_btnClose.width = GRoot.inst.width;
  67. _ui.m_btnClose.height = GRoot.inst.height;
  68. _ui.m_btnClose.AddRelation(GRoot.inst, RelationType.Size);
  69. _ui.m_btnLastStep.visible = true;
  70. _ui.m_btnNextStep.visible = true;
  71. _ui.m_btnClose.visible = false;
  72. _ui.m_grpTips.visible = false;
  73. _ui.m_btnRepeal.visible = false;
  74. _ui.m_btnRenewal.visible = false;
  75. _ui.m_btnSearch.visible = true;
  76. // _ui.m_comboBox.items = new string[] { "我的套装一", "我的套装二", "我的套装三", "我的套装四", "我的套装五", "我的套装六" };
  77. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高分优先", "低分优先" };
  78. _ui.m_partsListSearch.m_comboBoxRarity.items = new string[] { "高分优先", "低分优先" };
  79. InitLists();
  80. _ui.m_partsList.m_comboBoxRarity.onChanged.Add(OnComboBoxRarityChanged);
  81. _ui.m_partsListSearch.m_comboBoxRarity.onChanged.Add(OnSearchComboBoxRarityChanged);
  82. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  83. _ui.m_btnHome.onClick.Add(OnClickBtnHome);
  84. // _ui.m_btnClothingShop.onClick.Add(OnClickBtnClothingShop);
  85. // _ui.m_comboBox.onChanged.Add(OnComboBoxChanged);
  86. _ui.m_comListType1.m_listType.onClickItem.Add(OnClickListType1Item);
  87. _ui.m_comListType2.m_listType.onClickItem.Add(OnClickListType2Item);
  88. _ui.m_partsList.m_list.onClickItem.Add(OnClickPartsListItem);
  89. _ui.m_partsList2.m_list.onClickItem.Add(OnClickSuitPartsListItem);
  90. _ui.m_partsListSearch.m_list.onClickItem.Add(OnClickSearchPartsListItem);
  91. _ui.m_touchPad.onClick.Add(OnTouchPad);
  92. _ui.m_btnHint.onClick.Add(OnClickBtnHint);
  93. // _ui.m_btnGuide.onClick.Add(OnTouchPad);
  94. _ui.m_btnClose.onClick.Add(OnClickBtnClose);
  95. _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
  96. _ui.m_btnNext.onClick.Add(OnClickBtnNext);
  97. _ui.m_btnRecommend.onClick.Add(OnClickBtnRecommend);
  98. _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
  99. _ui.m_btnAutoPlay.onClick.Add(OnClickBtnAutoPlay);
  100. _ui.m_btnLastStep.onClick.Add(OnClickBtnLastStep);
  101. _ui.m_btnNextStep.onClick.Add(OnClickBtnNextStep);
  102. _ui.m_btnSubmission.onClick.Add(OnClickBtnSubmission);
  103. _ui.m_compNeed.target.onClick.Add(OnClickComNeed);
  104. _ui.m_compNeed.m_listTag.itemRenderer = RenderListTagItem;
  105. // _ui.m_btnShow.onClick.Add(OnClickBtnShow);
  106. // _ui.m_btnHide.onClick.Add(OnClickBtnHide);
  107. // _ui.m_loaShow.onClick.Add(OnClickLoaShow);
  108. // _ui.m_btnHide.visible = false;
  109. // EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdatePartsListSort);
  110. _ui.m_partsList2.m_comboBoxRarity.visible = false;
  111. _ui.m_partsList2.m_imgTop.visible = true;
  112. _ui.m_partsList.m_imgTop.visible = false;
  113. }
  114. protected override void AddEventListener()
  115. {
  116. base.AddEventListener();
  117. EventAgent.AddEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
  118. EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, UpdateSerch);
  119. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdateSerch);
  120. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
  121. // EventAgent.AddEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
  122. }
  123. protected override void RemoveEventListener()
  124. {
  125. base.RemoveEventListener();
  126. EventAgent.RemoveEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
  127. EventAgent.RemoveEventListener(ConstMessage.DRESS_SEARCH, UpdateSerch);
  128. EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, UpdateSerch);
  129. EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
  130. // EventAgent.RemoveEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
  131. }
  132. protected override void OnShown()
  133. {
  134. base.OnShown();
  135. var objData = (DressUpFightType)this.viewData;
  136. if (objData.teaPartID > 0) {
  137. IsTeaPart = true;
  138. _TeaPartyID = objData.teaPartID;
  139. }
  140. _levelID = objData.levelID;
  141. if (!IsTeaPart)
  142. _ui.m_c1.selectedIndex = 0;
  143. else
  144. _ui.m_c1.selectedIndex = 2;
  145. _ui.m_loaGuide.visible = true;
  146. InstanceZonesDataManager.usedRecommend = false;
  147. // _ui.m_comboBox.title = "我的套装";
  148. _ui.m_txtRecommendCount.SetVar("v1", "" + GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.RecommendCount)).FlushVars();
  149. _ui.m_txtRecommendCount.SetVar("v2", GlobalCfgArray.globalCfg.recommendCount.ToString()).FlushVars();
  150. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  151. _ui.m_btnAutoPlay.selected = FightDataManager.Instance.autoPlay;
  152. _ui.m_btnAutoPlay.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.FUNCTION_AUTOPLAY_FIGHT, false);
  153. _ui.m_btnRecommend.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.FUNCTION_AUTOPLAY_FIGHT, false);
  154. if (!IsTeaPart) {
  155. InstanceZonesDataManager.currentLevelCfgId = _levelID;
  156. _levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  157. _fightCfg = StoryFightCfgArray.Instance.GetCfg(_levelCfg.fightID);
  158. if (_levelCfg.type == ConstInstanceZonesType.Field)
  159. {
  160. scoreType = FieldDataManager.Instance.fieldInfos.theme;
  161. _ui.m_btnAutoPlay.visible = false;
  162. }
  163. else {
  164. scoreType = _fightCfg.scoreType;
  165. }
  166. InstanceZonesDataManager.FightScene = _levelCfg.type;
  167. _ui.m_compNeed.target.visible = _fightCfg.needItemId > 0 || _fightCfg.needSuitId > 0 || _fightCfg.needTagsArr.Length > 0;
  168. if (_ui.m_compNeed.target.visible)
  169. {
  170. _ui.m_compNeed.m_c1.selectedIndex = 0;
  171. if (_fightCfg.needItemId > 0)
  172. {
  173. _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetItemName(_fightCfg.needItemId);
  174. _ui.m_compNeed.target.data = _fightCfg.needItemId;
  175. _ui.m_compNeed.m_imgGot.visible = ItemDataManager.GetItemNum(_fightCfg.needItemId) > 0;
  176. }
  177. else if (_fightCfg.needSuitId > 0)
  178. {
  179. _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetSuitName(_fightCfg.needSuitId);
  180. _ui.m_compNeed.target.data = _fightCfg.needSuitId;
  181. _ui.m_compNeed.m_imgGot.visible = DressUpMenuSuitDataManager.CheckHaveSuit(_fightCfg.needSuitId);
  182. }
  183. else
  184. {
  185. _ui.m_compNeed.m_c1.selectedIndex = 1;
  186. _ui.m_compNeed.m_listTag.numItems = _fightCfg.needTagsArr.Length;
  187. _ui.m_compNeed.m_imgGot.visible = false;
  188. }
  189. }
  190. }
  191. InstanceZonesDataManager.currentScoreType = scoreType;
  192. //一级菜单
  193. _ui.m_comListType1.m_listType.RemoveChildrenToPool();
  194. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
  195. //_ui.m_comListType1.m_listType1.ResizeToFit(_ui.m_listType1.numItems);
  196. float maxHeight = _ui.target.height - _ui.m_comListType1.m_listType.y - DressUpView.BOTTOM_BLANK;
  197. if (_ui.m_comListType1.m_listType.height > maxHeight)
  198. {
  199. _ui.m_comListType1.m_listType.height = maxHeight;
  200. }
  201. _ui.m_comListType1.target.x = _ui.target.width;
  202. _ui.m_comListType2.target.x = _ui.target.width;
  203. _ui.m_partsList.target.x = _ui.target.width;
  204. _ui.m_partsList2.target.x = _ui.target.width;
  205. _ui.m_partsListSearch.target.x = _ui.target.width;
  206. _ui.m_scoreType.url = "ui://CommonGame/kp_sx_" + scoreType;
  207. this.showListType1();
  208. if (_sceneObject == null)
  209. {
  210. _sceneObject = GameObject.Instantiate(_scenePrefab);
  211. MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false);
  212. MyDressUpHelper.dressUpObj.PutOnDefaultDressUpData(IsTeaPart);
  213. }
  214. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  215. UpdateStepBtn(true);
  216. UpdateScore();
  217. if (!IsTeaPart)
  218. SendLog();
  219. else
  220. {
  221. var teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(LeagueDataManager.Instance.TeaPartyId);
  222. _ui.m_txtTeaPartyName.text = teapartyRoleCfg[objData.teaPartID - 1].name;
  223. }
  224. Timers.inst.AddUpdate(CheckGuide);
  225. }
  226. protected override void OnHide()
  227. {
  228. base.OnHide();
  229. _ui.m_btnClose.visible = false;
  230. _ui.m_grpTips.visible = false;
  231. if (_sceneObject != null)
  232. {
  233. GameObject.Destroy(_sceneObject);
  234. _sceneObject = null;
  235. }
  236. _fightCfg = null;
  237. _levelCfg = null;
  238. DressUpMenuItemDataManager.Clear();
  239. MyDressUpHelper.ResetMemory();
  240. Timers.inst.Remove(CheckGuide);
  241. }
  242. private void OnClickBtnLastStep()
  243. {
  244. if (!MyDressUpHelper.OnClickBtnLastStep()) return;
  245. UpdateStepBtn(false);
  246. }
  247. private void OnClickBtnNextStep()
  248. {
  249. if (!MyDressUpHelper.OnClickBtnNextStep()) return;
  250. UpdateStepBtn(false);
  251. }
  252. //茶话会提交搭配
  253. private void OnClickBtnSubmission()
  254. {
  255. ChangeTeapartyDressup();
  256. }
  257. private async void ChangeTeapartyDressup()
  258. {
  259. DressUpData dressUpData = MyDressUpHelper.dressUpObj.DressUpDataClone();
  260. bool result = await LeagueSproxy.ChangeTeapartyDressup(RoleDataManager.roleId, _TeaPartyID, dressUpData.itemList);
  261. if (result)
  262. {
  263. backView();
  264. }
  265. }
  266. private void backView()
  267. {
  268. if (IsTeaPart)
  269. {
  270. ViewManager.Show<LeagueTeaPartyView>();
  271. }
  272. else if (_levelCfg.type == ConstInstanceZonesType.Studio && _levelCfg.subType != ConstInstanceZonesSubType.Hard3)
  273. {
  274. ViewManager.Show(StudioDataManager.Instance.VIEW_NAME, StudioDataManager.Instance.PROPERTY_SELECT_INDEX, ViewManager.GetGoBackDatas(StudioDataManager.Instance.VIEW_NAME));
  275. }
  276. else if (_levelCfg.type == ConstInstanceZonesType.Studio && _levelCfg.subType == ConstInstanceZonesSubType.Hard3)
  277. {
  278. ViewManager.Show<StudioFilingView>(null, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName));
  279. }
  280. else if (_levelCfg.type == ConstInstanceZonesType.Field)
  281. {
  282. ViewManager.GoBackFrom(ViewName.DRESS_UP_FIGHT_VIEW);
  283. }
  284. else
  285. {
  286. // ViewManager.GoBackFrom(ViewName.STORY_CHAPTER_VIEW);
  287. ViewManager.Show<StoryChapterView>(_levelCfg.chapterId);//, new object[] { ViewName.STORY_CHAPTER_LIST_VIEW }
  288. }
  289. //MyDressUpHelper.dressUpObj.TakeOffAll();
  290. this.Hide();
  291. }
  292. private void OnClickBtnBack()
  293. {
  294. if (!IsTeaPart) {
  295. AlertUI.Show("是否确定退出?")
  296. .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
  297. {
  298. backView();
  299. });
  300. }
  301. else {
  302. AlertUI.Show("当期搭配未保存,是否放弃提交搭配?")
  303. .SetLeftButton(true, "放弃搭配", (object data) =>
  304. {
  305. backView();
  306. }).SetRightButton(true, "提交搭配", (object data) =>
  307. {
  308. ChangeTeapartyDressup();
  309. });
  310. }
  311. //ViewManager.Show<StoryChapterView>(StoryDataManager.currentChapter);
  312. }
  313. private void OnClickBtnHome()
  314. {
  315. AlertUI.Show("是否返回?")
  316. .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
  317. {
  318. //MyDressUpHelper.dressUpObj.TakeOffAll();
  319. GameController.GoBackToMainView();
  320. });
  321. }
  322. private void OnClickBtnClothingShop()
  323. {
  324. ViewManager.Show<ClothingShopView>(new object[] { null, scoreType }, null, false, true);
  325. }
  326. private void OnClickListType1Item(EventContext context)
  327. {
  328. // GuideController.HideGuide();
  329. GObject typeItem = context.data as GObject;
  330. int order = (int)typeItem.data;
  331. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[order - 1];
  332. if (item1.subMenusArr.Length > 0)
  333. {
  334. this.showListType2(item1.subMenusArr);
  335. }
  336. else
  337. {
  338. if (this.showListParts(item1.type) == false)
  339. {
  340. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  341. return;
  342. }
  343. this.showListParts(item1.type);
  344. }
  345. this.hideListType1();
  346. UpdateListPartsSelected();
  347. }
  348. private void OnClickListType2Item(EventContext context)
  349. {
  350. GObject typeItem = context.data as GObject;
  351. int order = (int)typeItem.data;
  352. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[order - 1];
  353. if (this.showListParts(item2.type) == false)
  354. {
  355. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  356. return;
  357. }
  358. this.hideListType2();
  359. }
  360. private void OnClickSearchPartsListItem(EventContext context)
  361. {
  362. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  363. {
  364. return;
  365. }
  366. GObject listItem = context.data as GObject;
  367. int id = (int)listItem.data;
  368. bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
  369. bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  370. bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
  371. bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
  372. if (isOrnament && !isDress && !isHasSame && isMaxCount)
  373. {
  374. PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
  375. return;
  376. }
  377. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  378. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  379. UpdateStepBtn(true);
  380. // UpdateSearchListPartsSelected();
  381. UpdateScore();
  382. }
  383. private void OnClickPartsListItem(EventContext context)
  384. {
  385. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  386. {
  387. return;
  388. }
  389. GObject listItem = context.data as GObject;
  390. int id = (int)listItem.data;
  391. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  392. {
  393. partsListScrollingPosY = _ui.m_partsList.m_list.scrollPane.scrollingPosY;
  394. this.showListParts2(id);
  395. this.hideListParts();
  396. MyDressUpHelper.dressUpObj.PutOnItemList(MyDressUpHelper.GetSuitFightItems(id));
  397. UpdateStepBtn(true);
  398. // MyDressUpHelper.dressUpObj.PutOnSuitCfg(id, false);
  399. }
  400. else
  401. {
  402. bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
  403. bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  404. bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
  405. bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
  406. if (isOrnament && !isDress && !isHasSame && isMaxCount)
  407. {
  408. PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
  409. return;
  410. }
  411. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  412. UpdateStepBtn(true);
  413. }
  414. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  415. // UpdateListPartsSelected();
  416. // UpdateListSuitPartsSelected();
  417. UpdateScore();
  418. }
  419. private void OnClickSuitPartsListItem(EventContext context)
  420. {
  421. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  422. {
  423. return;
  424. }
  425. GObject listItem = (GObject)context.data as GObject;
  426. int id = (int)listItem.data;
  427. bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
  428. bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  429. bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
  430. bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
  431. if (isOrnament && !isDress && !isHasSame && isMaxCount)
  432. {
  433. PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
  434. return;
  435. }
  436. if (!DressUpMenuItemDataManager.CheckHasItem(id))
  437. {
  438. PromptController.Instance.ShowFloatTextPrompt("还未获得这件装扮");
  439. return;
  440. }
  441. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  442. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  443. UpdateStepBtn(true);
  444. // UpdateListSuitPartsSelected();
  445. UpdateScore();
  446. }
  447. private void UpdateStepBtn(bool isAdd, int suitId = 0)
  448. {
  449. if (isAdd)
  450. {
  451. MyDressUpHelper.AddMemoryDressup();
  452. }
  453. _ui.m_btnLastStep.enabled = MyDressUpHelper.stepIndex > 0;
  454. _ui.m_btnNextStep.enabled = MyDressUpHelper.stepIndex < MyDressUpHelper.dressMemory.Count - 1;
  455. UpdateListPartsSelected();
  456. UpdateListSuitPartsSelected();
  457. }
  458. private void OnLongPress(EventContext context)
  459. {
  460. LongPressGesture gesture = (LongPressGesture)context.sender;
  461. int itemId = (int)gesture.host.data;
  462. GoodsItemTipsController.ShowItemTips(itemId);
  463. }
  464. private void OnTouchPad()
  465. {
  466. if (this.currentListType == DressUpListType.List4)
  467. {
  468. this.hideListParts2();
  469. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  470. }
  471. else if (this.currentListType == DressUpListType.List3)
  472. {
  473. if (_currentList2 != null)
  474. {
  475. this.showListType2(_currentList2);
  476. }
  477. else
  478. {
  479. this.showListType1();
  480. }
  481. this.hideListParts();
  482. }
  483. else if (this.currentListType == DressUpListType.List2)
  484. {
  485. this.showListType1();
  486. this.hideListType2();
  487. }
  488. else if (this.currentListType == DressUpListType.List5)
  489. {
  490. this.showListType1();
  491. this.hideSearchListType();
  492. }
  493. }
  494. private void OnClickBtnHint()
  495. {
  496. this.ShowTaskHint();
  497. }
  498. private void OnClickBtnDelete()
  499. {
  500. MyDressUpHelper.dressUpObj.TakeOffAll();
  501. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  502. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  503. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  504. UpdateStepBtn(true);
  505. // UpdateListPartsSelected();
  506. // UpdateListSuitPartsSelected();
  507. }
  508. private void OnClickBtnClose()
  509. {
  510. _ui.m_btnClose.visible = false;
  511. _ui.m_grpTips.visible = false;
  512. }
  513. private void OnClickBtnNext()
  514. {
  515. // if (!MyDressUpHelper.CheckPutOnFinish())
  516. // {
  517. // AlertUI.Show("只有换好衣服才能出门哦!")
  518. // .SetRightButton(true, "好的");
  519. // return;
  520. // }
  521. if (!CheckHasNeed())
  522. {
  523. AlertUI.Show("未穿戴必需品。").SetRightButton(true, "好的");
  524. return;
  525. }
  526. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  527. if (RoleDataManager.power < levelCfg.power)
  528. {
  529. ItemUtil.AddPower(OnClickBtnPhotograph);
  530. return;
  531. }
  532. OnClickBtnPhotograph();
  533. }
  534. private bool CheckHasNeed()
  535. {
  536. int _suitId = MyDressUpHelper.dressUpObj.suitId;
  537. bool isNoSuit = _fightCfg.needSuitId > 0 && _suitId != _fightCfg.needSuitId;//需要套装但未穿套装
  538. bool isDressUpItem = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(_fightCfg.needItemId);
  539. bool isIncludeItem = _suitId > 0 && Array.IndexOf(SuitCfgArray.Instance.GetCfg(_suitId).partsArr, _fightCfg.needItemId) >= 0;
  540. bool isNoItem = _fightCfg.needItemId > 0 && !isDressUpItem && !isIncludeItem;
  541. if (isNoSuit || isNoItem)
  542. {
  543. return false;
  544. }
  545. return true;
  546. }
  547. private void OnClickBtnPhotograph()
  548. {
  549. Timers.inst.StartCoroutine(ScreenShotTex());
  550. }
  551. private IEnumerator ScreenShotTex()
  552. {
  553. GameObject Role = _sceneObject.transform.Find("Role").gameObject;
  554. GameObject CopyRoleParent = _sceneObject.transform.Find("CopyRole").gameObject;
  555. Transform CopyRole = CopyRoleParent.transform.Find("Role");
  556. if (CopyRole != null)
  557. {
  558. GameObject.DestroyImmediate(CopyRole.gameObject);
  559. }
  560. Transform transform = GameObject.Instantiate(Role, CopyRoleParent.transform.position, Quaternion.identity).transform;//实例化物体
  561. transform.parent = CopyRoleParent.transform;
  562. transform.name = "Role";
  563. GameObject gameObject = _sceneObject.transform.Find("FightCamera").gameObject;
  564. Camera camera = gameObject.GetComponent<Camera>();
  565. FightDataManager.Instance.RoleTextuex = FightDataManager.Instance.GetPrintscreenNTexture(camera);
  566. yield return new WaitForEndOfFrame();
  567. if (CardDataManager.GetCardListByRoleType(0).Count > 0)
  568. {
  569. ViewManager.Show<StoryCardChoose>(scoreType);
  570. }
  571. else
  572. {
  573. StartCalculateScore();
  574. }
  575. }
  576. private void StartCalculateScore()
  577. {
  578. //不可移动代码位置
  579. bool hasFightTarget = _fightCfg.targetName != null && _fightCfg.targetName.Length > 0;
  580. if (_levelCfg.type == ConstInstanceZonesType.Field)
  581. {
  582. FieldFightDataManager.Instance.CurrentCardId = InstanceZonesDataManager.currentCardId;
  583. FieldFightDataManager.Instance.CurrentScoreType = InstanceZonesDataManager.currentScoreType;
  584. FieldFightDataManager.Instance.currentLevelCfgId = InstanceZonesDataManager.currentLevelCfgId;
  585. }
  586. if (hasFightTarget)
  587. {
  588. ViewManager.Show<StoryFightTargetView>();
  589. }
  590. else
  591. {
  592. ViewManager.Show<StoryFightSingleView>();
  593. }
  594. this.Hide();
  595. }
  596. private void OnClickBtnRecommend()
  597. {
  598. if (this.currentListType == DressUpListType.List4)
  599. {
  600. this.hideListParts2();
  601. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  602. }
  603. InstanceZonesDataManager.usedRecommend = true;
  604. // MyDressUpHelper.PutOnRecommendItems();
  605. MyDressUpHelper.PutOnRecommendItems2();
  606. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  607. UpdateStepBtn(true);
  608. // UpdateListPartsSelected();
  609. // UpdateListSuitPartsSelected();
  610. UpdateScore();
  611. if (!CheckHasNeed())
  612. {
  613. PromptController.Instance.ShowFloatTextPrompt("未拥有必需品");
  614. }
  615. }
  616. private void InitLists()
  617. {
  618. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  619. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  620. _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
  621. _ui.m_partsListSearch.m_list.itemRenderer = ListPartsItem;
  622. listType1X = _ui.m_comListType1.target.x;
  623. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width;
  624. //一级菜单
  625. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  626. }
  627. private void showListType1()
  628. {
  629. _currentList2 = null;
  630. currentListType = DressUpListType.List1;
  631. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
  632. GTween.To(_ui.target.width, listType1X, 0.5f)
  633. .SetTarget(_ui.m_comListType1.target)
  634. .OnUpdate((GTweener t) =>
  635. {
  636. _ui.m_comListType1.target.x = t.value.x;
  637. });
  638. }
  639. private void hideListType1()
  640. {
  641. GTween.To(listType1X, _ui.target.width, 0.5f)
  642. .SetTarget(_ui.m_comListType1.target)
  643. .OnUpdate((GTweener t) =>
  644. {
  645. _ui.m_comListType1.target.x = t.value.x;
  646. });
  647. }
  648. private void showListType2(int[] menuStrArr = null)
  649. {
  650. currentListType = DressUpListType.List2;
  651. if (menuStrArr != null && menuStrArr.Length > 0)
  652. {
  653. int len = menuStrArr.Length;
  654. _currentList2 = menuStrArr.Clone() as int[];
  655. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  656. _ui.m_comListType2.m_listType.numItems = len;
  657. //_ui.m_listType2.ResizeToFit(_ui.m_listType2.numItems);
  658. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  659. if (_ui.m_comListType2.m_listType.height > maxHeight)
  660. {
  661. _ui.m_comListType2.m_listType.height = maxHeight;
  662. }
  663. }
  664. GTween.To(_ui.target.width, listType1X, 0.5f)
  665. .SetTarget(_ui.m_comListType2.target)
  666. .OnUpdate((GTweener t) =>
  667. {
  668. _ui.m_comListType2.target.x = t.value.x;
  669. });
  670. }
  671. private void hideListType2()
  672. {
  673. GTween.To(listType1X, _ui.target.width, 0.5f)
  674. .SetTarget(_ui.m_comListType2.target)
  675. .OnUpdate((GTweener t) =>
  676. {
  677. _ui.m_comListType2.target.x = t.value.x;
  678. });
  679. }
  680. private bool showListParts(int type, bool selectItem = false)
  681. {
  682. _currentMenuType = type;
  683. UpdatePartsListSort();
  684. if (_ui.m_partsList.m_list.numItems <= 0) return false;
  685. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  686. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;
  687. if (_ui.m_partsList.m_list.height > maxHeight)
  688. {
  689. _ui.m_partsList.m_list.height = maxHeight;
  690. }
  691. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  692. {
  693. _ui.m_partsList.m_list.scrollPane.SetPosY(partsListScrollingPosY, false);
  694. partsListScrollingPosY = 0;
  695. }
  696. currentListType = DressUpListType.List3;
  697. GTween.To(_ui.target.width, partsListX, 0.5f)
  698. .SetTarget(_ui.m_partsList)
  699. .OnUpdate((GTweener t) =>
  700. {
  701. _ui.m_partsList.target.x = t.value.x;
  702. });
  703. UpdateListPartsSelected();
  704. return true;
  705. }
  706. private void OnComboBoxRarityChanged()
  707. {
  708. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  709. this.UpdatePartsListSort();
  710. }
  711. private void OnSearchComboBoxRarityChanged()
  712. {
  713. _scoreIndex = _ui.m_partsListSearch.m_comboBoxRarity.selectedIndex;
  714. this.UpdateSearchList();
  715. }
  716. private void UpdatePartsListSort()
  717. {
  718. if (_currentMenuType == 0) return;
  719. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  720. {
  721. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  722. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  723. {
  724. _currentList3 = SuitUtil.SortSuitListByHighScore(_currentList3);
  725. }
  726. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  727. {
  728. _currentList3 = SuitUtil.SortSuitListByLowScore(_currentList3);
  729. }
  730. else
  731. {
  732. _currentList3.Reverse();
  733. }
  734. }
  735. else
  736. {
  737. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  738. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  739. {
  740. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3, true);
  741. }
  742. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  743. {
  744. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3, true);
  745. }
  746. else
  747. {
  748. _currentList3.Reverse();
  749. }
  750. }
  751. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  752. // {
  753. // _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
  754. // }
  755. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  756. // {
  757. // _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
  758. // }
  759. //必穿品放在列表最前面
  760. if (_fightCfg!= null && _fightCfg.needItemId > 0)
  761. {
  762. int index = _currentList3.IndexOf(_fightCfg.needItemId);
  763. if (index >= 0)
  764. {
  765. int item = _currentList3[index];
  766. _currentList3.Remove(_currentList3[index]);
  767. _currentList3.Insert(0, item);
  768. }
  769. }
  770. else if (_fightCfg != null && _fightCfg.needSuitId > 0)
  771. {
  772. int index = _currentList3.IndexOf(_fightCfg.needSuitId);
  773. if (index >= 0)
  774. {
  775. int item = _currentList3[index];
  776. _currentList3.Remove(_currentList3[index]);
  777. _currentList3.Insert(0, item);
  778. }
  779. }
  780. _ui.m_partsList.m_list.RemoveChildrenToPool();
  781. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  782. }
  783. private void UpdateSuitPartsListSort()
  784. {
  785. if (_currentMenuType == 0) return;
  786. _currentList4 = new List<int>(SuitCfgArray.Instance.GetSuitItems(_currentSuitId, true));
  787. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  788. // {
  789. // _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4);
  790. // }
  791. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  792. // {
  793. // _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4);
  794. // }
  795. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  796. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  797. }
  798. private void hideListParts()
  799. {
  800. GTween.To(partsListX, _ui.target.width, 0.5f)
  801. .SetTarget(_ui.m_partsList)
  802. .OnUpdate((GTweener t) =>
  803. {
  804. _ui.m_partsList.target.x = t.value.x;
  805. });
  806. }
  807. private void showListParts2(int suitId)
  808. {
  809. _currentSuitId = suitId;
  810. _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  811. this.UpdateSuitPartsListSort();
  812. _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
  813. float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
  814. if (_ui.m_partsList2.m_list.height > maxHeight)
  815. {
  816. _ui.m_partsList2.m_list.height = maxHeight;
  817. }
  818. currentListType = DressUpListType.List4;
  819. GTween.To(_ui.target.width, partsListX, 0.5f)
  820. .SetTarget(_ui.m_partsList2)
  821. .OnUpdate((GTweener t) =>
  822. {
  823. _ui.m_partsList2.target.x = t.value.x;
  824. });
  825. }
  826. private void hideListParts2()
  827. {
  828. _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
  829. GTween.To(partsListX, _ui.target.width, 0.5f)
  830. .SetTarget(_ui.m_partsList2)
  831. .OnUpdate((GTweener t) =>
  832. {
  833. _ui.m_partsList2.target.x = t.value.x;
  834. });
  835. }
  836. private void showSearchListType()
  837. {
  838. // _currentList2 = null;
  839. currentListType = DressUpListType.List5;
  840. GTween.To(_ui.target.width, partsListX, 0.5f)
  841. .SetTarget(_ui.m_partsListSearch.target)
  842. .OnUpdate((GTweener t) =>
  843. {
  844. _ui.m_partsListSearch.target.x = t.value.x;
  845. });
  846. }
  847. private void hideSearchListType()
  848. {
  849. GTween.To(partsListX, _ui.target.width, 0.5f)
  850. .SetTarget(_ui.m_partsListSearch.target)
  851. .OnUpdate((GTweener t) =>
  852. {
  853. _ui.m_partsListSearch.target.x = t.value.x;
  854. });
  855. }
  856. /*****************************************************************************************************/
  857. private void DressResetSerch()
  858. {
  859. if (currentListType == DressUpListType.List5)
  860. {
  861. OnTouchPad();
  862. }
  863. }
  864. private void UpdateSerch(EventContext context)
  865. {
  866. if (context.data.ToString() == ConstMessage.DRESS_SEARCH)
  867. {
  868. _currentList3 = DressUpMenuItemDataManager.DressSearch(false);
  869. }
  870. else if (context.data.ToString() == ConstMessage.DRESS_FILTER)
  871. {
  872. _currentList3 = DressUpMenuItemDataManager.DressFilter(false);
  873. }
  874. ViewManager.Hide<ModalStatusView>();
  875. UpdateSearchList();
  876. if (currentListType != DressUpListType.List5)
  877. {
  878. hideListParts();
  879. hideListParts2();
  880. hideListType1();
  881. hideListType2();
  882. showSearchListType();
  883. }
  884. _currentMenuType = 0;
  885. }
  886. private void UpdateSearchList()
  887. {
  888. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  889. {
  890. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3, true);
  891. }
  892. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  893. {
  894. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3, true);
  895. }
  896. _currentMenuType = 0;
  897. _ui.m_partsListSearch.m_list.numItems = _currentList3.Count; ;
  898. }
  899. private void ListType1Item(int index, GObject item)
  900. {
  901. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  902. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
  903. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
  904. typeItem.m_txtname.text = item1.name;
  905. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  906. typeItem.target.data = item1.id;
  907. if (!IsTeaPart)
  908. {
  909. typeItem.m_imgNeed.visible = ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, item1.id);
  910. typeItem.m_itemType.selectedIndex = 0;
  911. }
  912. else
  913. typeItem.m_itemType.selectedIndex = 1;
  914. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.id);
  915. UI_TypeItem.ProxyEnd();
  916. }
  917. private void ListType2Item(int index, GObject item)
  918. {
  919. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  920. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
  921. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
  922. typeItem.m_txtname.text = item2.name;
  923. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  924. typeItem.target.data = item2.id;
  925. if (!IsTeaPart) {
  926. typeItem.m_itemType.selectedIndex = 0;
  927. var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  928. typeItem.m_imgNeed.visible = subType == item2.type;
  929. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.id);
  930. }
  931. else
  932. typeItem.m_itemType.selectedIndex = 1;
  933. UI_TypeItem.ProxyEnd();
  934. }
  935. private void ListTagItem(int index, GObject item)
  936. {
  937. ItemCfg itemCfg = (ItemCfg)item.parent.data;
  938. UI_ComTagItem listItem = UI_ComTagItem.Proxy(item);
  939. string name = itemCfg.tagsArr[index][0].ToString();
  940. string score = itemCfg.tagsArr[index][1];
  941. int tagType = TagCfgArray.Instance.GetCfg(name).type;
  942. UI.CommonGame.UI_ComTag itemTag = UI.CommonGame.UI_ComTag.Proxy(listItem.m_loaTag);
  943. itemTag.m_txtTag.text = name;
  944. itemTag.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
  945. itemTag.m_loaTag.scale = new Vector2(0.8f, 0.8f);
  946. UI.CommonGame.UI_ComTag.ProxyEnd();
  947. listItem.m_txtScore.text = score;
  948. UI_ComTagItem.ProxyEnd();
  949. }
  950. private void ListSuitTagItem(int index, GObject item)
  951. {
  952. Dictionary<int, Dictionary<string, int>> tagsArr = (Dictionary<int, Dictionary<string, int>>)item.parent.data;
  953. UI_ComTagItem listItem = UI_ComTagItem.Proxy(item);
  954. string name = "";
  955. string score = "";
  956. foreach (var info in tagsArr[index].Keys) {
  957. name = info;
  958. score = tagsArr[index][info].ToString();
  959. }
  960. int tagType = TagCfgArray.Instance.GetCfg(name).type;
  961. UI.CommonGame.UI_ComTag itemTag = UI.CommonGame.UI_ComTag.Proxy(listItem.m_loaTag);
  962. itemTag.m_txtTag.text = name;
  963. itemTag.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
  964. itemTag.m_loaTag.scale = new Vector2(0.8f, 0.8f);
  965. UI.CommonGame.UI_ComTag.ProxyEnd();
  966. listItem.m_txtScore.text = score;
  967. UI_ComTagItem.ProxyEnd();
  968. }
  969. private void ListPartsItem(int index, GObject item)
  970. {
  971. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  972. int id = (int)_currentList3[index];
  973. string iconRes = "";
  974. string partName = "";
  975. string ext = "png";
  976. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  977. {
  978. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  979. iconRes = suitCfg.res;
  980. partName = suitCfg.name;
  981. listItem.m_iconSelected.visible = false;
  982. if (!IsTeaPart)
  983. {
  984. listItem.m_txtScore.text = "" + SuitUtil.GetSuitScore(id);
  985. listItem.m_itemType.selectedIndex = 0;
  986. }
  987. else
  988. {
  989. if (listItem.m_ListTag.data == null)
  990. listItem.m_ListTag.itemRenderer = ListSuitTagItem;
  991. var tagCfg = DressUpMenuSuitDataManager.GetSuitTagCfgArray(id);
  992. listItem.m_ListTag.data = tagCfg;
  993. listItem.m_ListTag.numItems = tagCfg.Count;
  994. listItem.m_itemType.selectedIndex = 1;
  995. }
  996. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  997. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.rarity;
  998. listItem.m_imgNew.visible = false;
  999. }
  1000. else
  1001. {
  1002. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  1003. iconRes = itemCfg.res;
  1004. partName = itemCfg.name;
  1005. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  1006. if (!IsTeaPart) {
  1007. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _fightCfg.needTagsArr);
  1008. listItem.m_itemType.selectedIndex = 0;
  1009. }
  1010. else {
  1011. if (listItem.m_ListTag.data == null)
  1012. listItem.m_ListTag.itemRenderer = ListTagItem;
  1013. listItem.m_ListTag.data = itemCfg;
  1014. listItem.m_ListTag.numItems = itemCfg.tagsArr.Length;
  1015. listItem.m_itemType.selectedIndex = 1;
  1016. }
  1017. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  1018. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  1019. listItem.m_imgNew.visible = isNew;
  1020. if (isNew)
  1021. {
  1022. ItemProxy.ReqSetItemRead(id).Coroutine();
  1023. }
  1024. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  1025. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  1026. }
  1027. if (listItem.target.data == null)
  1028. {
  1029. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  1030. longPressGesture.once = true;
  1031. longPressGesture.onAction.Add(OnLongPress);
  1032. _listLongPress.Add(longPressGesture);
  1033. }
  1034. listItem.m_btnAni.visible = false;
  1035. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  1036. listItem.m_ScoreType.url = "ui://CommonGame/kp_sx_" + scoreType;
  1037. listItem.m_txtTitle.text = partName;
  1038. listItem.target.data = id;
  1039. listItem.m_imgNeed.visible = _fightCfg != null && (_fightCfg.needItemId == id || _fightCfg.needSuitId == id);
  1040. UI_PartsListItem.ProxyEnd();
  1041. }
  1042. private void ListParts2Item(int index, GObject item)
  1043. {
  1044. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  1045. int id = (int)_currentList4[index];
  1046. string iconRes = "";
  1047. string partName = "";
  1048. string ext = "png";
  1049. if (listItem.target.data == null)
  1050. {
  1051. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  1052. longPressGesture.once = true;
  1053. longPressGesture.onAction.Add(OnLongPress);
  1054. _listLongPress.Add(longPressGesture);
  1055. }
  1056. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  1057. iconRes = itemCfg.res;
  1058. partName = itemCfg.name;
  1059. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  1060. if (!IsTeaPart)
  1061. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _fightCfg.needTagsArr);
  1062. else
  1063. {
  1064. if (listItem.m_ListTag.data == null)
  1065. listItem.m_ListTag.itemRenderer = ListTagItem;
  1066. listItem.m_ListTag.data = itemCfg;
  1067. listItem.m_ListTag.numItems = itemCfg.tagsArr.Length;
  1068. }
  1069. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  1070. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  1071. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  1072. listItem.m_ScoreType.visible = true;
  1073. // int mainScore;
  1074. // int mainValuel;
  1075. // ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
  1076. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + scoreType);
  1077. if (!IsTeaPart) {
  1078. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _fightCfg.needTagsArr);
  1079. listItem.m_itemType.selectedIndex = 0;
  1080. }
  1081. else
  1082. {
  1083. if (listItem.m_ListTag.data == null)
  1084. {
  1085. listItem.m_ListTag.itemRenderer = ListTagItem;
  1086. }
  1087. listItem.m_ListTag.data = itemCfg;
  1088. listItem.m_ListTag.numItems = itemCfg.tagsArr.Length;
  1089. listItem.m_itemType.selectedIndex = 1;
  1090. }
  1091. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  1092. listItem.m_txtTitle.text = partName;
  1093. listItem.target.data = id;
  1094. // listItem.m_txtScore.visible = false;
  1095. //listItem.m_ScoreType.visible = true;
  1096. listItem.m_imgNeed.visible = false;
  1097. listItem.m_btnAni.visible = false;
  1098. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  1099. listItem.m_imgNew.visible = isNew;
  1100. if (isNew)
  1101. {
  1102. ItemProxy.ReqSetItemRead(id).Coroutine();
  1103. }
  1104. UI_PartsListItem.ProxyEnd();
  1105. }
  1106. private void UpdateListPartsSelected()
  1107. {
  1108. GList list;
  1109. if (_ui.m_partsList.target.x == partsListX)
  1110. {
  1111. list = _ui.m_partsList.m_list;
  1112. }
  1113. else if (_ui.m_partsListSearch.target.x == partsListX)
  1114. {
  1115. list = _ui.m_partsListSearch.m_list;
  1116. }
  1117. else
  1118. {
  1119. return;
  1120. }
  1121. int count = list.numChildren;
  1122. int suitId = MyDressUpHelper.dressUpObj.suitId;
  1123. for (int i = 0; i < count; i++)
  1124. {
  1125. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(i));
  1126. int id = (int)listItem.target.data;
  1127. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  1128. {
  1129. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  1130. }
  1131. else
  1132. {
  1133. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  1134. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  1135. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  1136. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  1137. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  1138. }
  1139. UI_PartsListItem.ProxyEnd();
  1140. }
  1141. }
  1142. private void UpdateSearchListPartsSelected()
  1143. {
  1144. int count = _ui.m_partsListSearch.m_list.numChildren;
  1145. int suitId = MyDressUpHelper.dressUpObj.suitId;
  1146. for (int i = 0; i < count; i++)
  1147. {
  1148. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsListSearch.m_list.GetChildAt(i));
  1149. int id = (int)listItem.target.data;
  1150. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  1151. {
  1152. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  1153. }
  1154. else
  1155. {
  1156. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  1157. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  1158. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  1159. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  1160. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  1161. }
  1162. UI_PartsListItem.ProxyEnd();
  1163. }
  1164. }
  1165. private void UpdateListSuitPartsSelected()
  1166. {
  1167. int count = _ui.m_partsList2.m_list.numChildren;
  1168. int suitId = MyDressUpHelper.dressUpObj.suitId;
  1169. for (int i = 0; i < count; i++)
  1170. {
  1171. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  1172. int id = (int)listItem.target.data;
  1173. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  1174. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  1175. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  1176. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  1177. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  1178. UI_PartsListItem.ProxyEnd();
  1179. }
  1180. }
  1181. private void ShowTaskHint()
  1182. {
  1183. _ui.m_btnClose.visible = true;
  1184. _ui.m_grpTips.visible = true;
  1185. string str = "";
  1186. if (!IsTeaPart)
  1187. str = _levelCfg.hint;
  1188. else {
  1189. var teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(LeagueDataManager.Instance.TeaPartyId);
  1190. str = teapartyRoleCfg[_TeaPartyID - 1].hint;
  1191. }
  1192. _ui.m_txtHint.text = str;
  1193. if (this._ui.m_txtHint.textHeight > this._ui.m_txtHint.textFormat.size * 2)
  1194. {
  1195. this._ui.m_txtHint.align = AlignType.Left;
  1196. }
  1197. else
  1198. {
  1199. this._ui.m_txtHint.align = AlignType.Center;
  1200. }
  1201. }
  1202. private void UpdateScore()
  1203. {
  1204. if (!IsTeaPart)
  1205. _ui.m_txtScore.text = "" + FightDataManager.Instance.GetScore(InstanceZonesDataManager.roleData).ToString();
  1206. // GuideController.TryGuideDressUpFightViewBtnNext(_ui.m_btnNext);
  1207. else
  1208. _ui.m_txtMatch.text = "" + LeagueDataManager.Instance.GetTeaPartyMatchedValue(InstanceZonesDataManager.roleData);
  1209. }
  1210. private void OnClickBtnSearch()
  1211. {
  1212. ViewManager.Show<DressFilterView>(false, new object[] { ViewName.DRESS_UP_VIEW });
  1213. }
  1214. private void OnClickBtnAutoPlay()
  1215. {
  1216. FightDataManager.Instance.autoPlay = _ui.m_btnAutoPlay.selected;
  1217. }
  1218. private void OnClickComNeed()
  1219. {
  1220. if (_fightCfg.needItemId <= 0 && _fightCfg.needSuitId <= 0)
  1221. {
  1222. return;
  1223. }
  1224. if (_fightCfg.needSuitId > 0)
  1225. {
  1226. ViewManager.Show<SuitPartsDetailView>(_fightCfg.needSuitId, new object[] { typeof(DressUpFightView).FullName, this.viewData });
  1227. }
  1228. else
  1229. {
  1230. int itemId = (int)_ui.m_compNeed.target.data;
  1231. object[] sourceDatas = new object[] { itemId, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData }, 1 };
  1232. GoodsItemTipsController.ShowItemTips(itemId, sourceDatas);
  1233. }
  1234. }
  1235. private void RenderListTagItem(int index, GObject obj)
  1236. {
  1237. UI.CommonGame.UI_ComTag item = UI.CommonGame.UI_ComTag.Proxy(obj);
  1238. string tag = _fightCfg.needTagsArr[index];
  1239. int tagType = TagCfgArray.Instance.GetCfg(tag).type;
  1240. item.m_txtTag.text = tag;
  1241. item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
  1242. UI.CommonGame.UI_ComTag.ProxyEnd();
  1243. }
  1244. private bool CheckListCount(int type)
  1245. {
  1246. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  1247. {
  1248. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  1249. }
  1250. else
  1251. {
  1252. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  1253. }
  1254. }
  1255. private void SendLog()
  1256. {
  1257. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  1258. switch (levelCfg.type)
  1259. {
  1260. case ConstInstanceZonesType.Story:
  1261. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CHUN_ZHONG_LOU, 2);
  1262. break;
  1263. case ConstInstanceZonesType.Studio:
  1264. StudioCfg studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
  1265. if (studioCfg.funId == typeof(StudioMetalView).Name)
  1266. {
  1267. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 2);
  1268. }
  1269. else if (studioCfg.funId == typeof(StudioFabricView).Name)
  1270. {
  1271. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 2);
  1272. }
  1273. else if (studioCfg.funId == typeof(StudioPropertyView).Name)
  1274. {
  1275. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 2);
  1276. }
  1277. break;
  1278. }
  1279. }
  1280. private void CheckGuide(object param)
  1281. {
  1282. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0
  1283. || GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0
  1284. || GuideDataManager.IsGuideFinish(ConstGuideId.AUTOPLAY_FIGHT) <= 0)
  1285. {
  1286. UpdateToCheckGuide(null);
  1287. }
  1288. else
  1289. {
  1290. Timers.inst.Remove(CheckGuide);
  1291. }
  1292. _ui.m_loaGuide.visible = false;
  1293. }
  1294. protected override void UpdateToCheckGuide(object param)
  1295. {
  1296. if (!ViewManager.CheckIsTopView(this.viewCom) || IsTeaPart) return;
  1297. int buyClothingIndex = 0;
  1298. int buyClothingSubIndex = 0;
  1299. int taozhuangIndex = 0;
  1300. int len = _ui.m_comListType1.m_listType.numChildren;
  1301. for (int i = 0; i < len; i++)
  1302. {
  1303. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  1304. if (item != null)
  1305. {
  1306. int menuID = (int)item.target.data;
  1307. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  1308. if (GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0 && dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  1309. {
  1310. taozhuangIndex = i;
  1311. break;
  1312. }
  1313. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0 && _fightCfg.needItemId > 0 && ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, dressUpMenuItemCfg1.id))
  1314. {
  1315. buyClothingIndex = i;
  1316. break;
  1317. }
  1318. }
  1319. UI_TypeItem.ProxyEnd();
  1320. }
  1321. buyClothingSubIndex = _currentList3.IndexOf(_fightCfg.needItemId);
  1322. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.START_FIGHT, 3, "点击相应的分类,可以快速找到服饰。", taozhuangIndex);
  1323. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.START_FIGHT, 4, "", 0);
  1324. GuideController.TryGuide(_ui.m_btnNext, ConstGuideId.START_FIGHT, 5, "穿着完毕,来验证一下,换上的服饰是否符合需求。");
  1325. // GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
  1326. GuideController.TryGuide(_ui.m_compNeed.target, ConstGuideId.BUY_CLOTHING, 3, "当提示有“必需品”时,需要穿上对应物品才能通关。");
  1327. GuideController.TryGuide(_ui.m_btnRecommend, ConstGuideId.BUY_CLOTHING, 7, "点击推荐搭配,可以快速穿上必须品。");
  1328. GuideController.TryGuide(_ui.m_btnAutoPlay, ConstGuideId.BUY_CLOTHING, 8, "勾选后,会自动进行比拼哦~~");
  1329. GuideController.TryCompleteGuide(ConstGuideId.BUY_CLOTHING, 8);
  1330. GuideController.TryGuide(_ui.m_btnHint, ConstGuideId.FIGHT_TIPS, 1, "这次换装需要获得别人的认可呢。");
  1331. GuideController.TryCompleteGuide(ConstGuideId.FIGHT_TIPS, 1);
  1332. GuideController.TryGuide(_ui.m_btnRecommend, ConstGuideId.AUTOPLAY_FIGHT, 1, "", -1, true, 0, true, true);//这个引导自动完成,测试中策划要求件推荐搭配引导提前,为避免意外,没有改引导表,而是直接吧推荐搭配加到买必须品的引导力,这个引导自动完成
  1333. if (GuideDataManager.currentGuideId == GuideCfgArray.Instance.GetCfg(ConstGuideId.AUTOPLAY_FIGHT).id) GuideController.TryCompleteGuideIndex(ConstGuideId.AUTOPLAY_FIGHT, 1);
  1334. GuideController.TryCompleteGuide(ConstGuideId.AUTOPLAY_FIGHT, 1);
  1335. }
  1336. protected override void TryCompleteGuide()
  1337. {
  1338. base.TryCompleteGuide();
  1339. // GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
  1340. }
  1341. }
  1342. }