DressUpFightView.cs 54 KB

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