DressUpFightView.cs 59 KB

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