DressUpFightView.cs 55 KB

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