DressUpFightView.cs 52 KB

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