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. UpdateListPartsSelected();
  540. UpdateListSuitPartsSelected();
  541. UpdateScore();
  542. if (!CheckHasNeed())
  543. {
  544. PromptController.Instance.ShowFloatTextPrompt("未拥有必需品");
  545. }
  546. }
  547. private void InitLists()
  548. {
  549. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  550. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  551. _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
  552. _ui.m_partsListSearch.m_list.itemRenderer = ListPartsItem;
  553. listType1X = _ui.m_comListType1.target.x;
  554. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width;
  555. //一级菜单
  556. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  557. }
  558. private void showListType1()
  559. {
  560. _currentList2 = null;
  561. currentListType = DressUpListType.List1;
  562. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
  563. GTween.To(_ui.target.width, listType1X, 0.5f)
  564. .SetTarget(_ui.m_comListType1.target)
  565. .OnUpdate((GTweener t) =>
  566. {
  567. _ui.m_comListType1.target.x = t.value.x;
  568. });
  569. }
  570. private void hideListType1()
  571. {
  572. GTween.To(listType1X, _ui.target.width, 0.5f)
  573. .SetTarget(_ui.m_comListType1.target)
  574. .OnUpdate((GTweener t) =>
  575. {
  576. _ui.m_comListType1.target.x = t.value.x;
  577. });
  578. }
  579. private void showListType2(int[] menuStrArr = null)
  580. {
  581. currentListType = DressUpListType.List2;
  582. if (menuStrArr != null && menuStrArr.Length > 0)
  583. {
  584. int len = menuStrArr.Length;
  585. _currentList2 = menuStrArr.Clone() as int[];
  586. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  587. _ui.m_comListType2.m_listType.numItems = len;
  588. //_ui.m_listType2.ResizeToFit(_ui.m_listType2.numItems);
  589. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  590. if (_ui.m_comListType2.m_listType.height > maxHeight)
  591. {
  592. _ui.m_comListType2.m_listType.height = maxHeight;
  593. }
  594. }
  595. GTween.To(_ui.target.width, listType1X, 0.5f)
  596. .SetTarget(_ui.m_comListType2.target)
  597. .OnUpdate((GTweener t) =>
  598. {
  599. _ui.m_comListType2.target.x = t.value.x;
  600. });
  601. }
  602. private void hideListType2()
  603. {
  604. GTween.To(listType1X, _ui.target.width, 0.5f)
  605. .SetTarget(_ui.m_comListType2.target)
  606. .OnUpdate((GTweener t) =>
  607. {
  608. _ui.m_comListType2.target.x = t.value.x;
  609. });
  610. }
  611. private bool showListParts(int type, bool selectItem = false)
  612. {
  613. _currentMenuType = type;
  614. UpdatePartsListSort();
  615. if (_ui.m_partsList.m_list.numItems <= 0) return false;
  616. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  617. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;
  618. if (_ui.m_partsList.m_list.height > maxHeight)
  619. {
  620. _ui.m_partsList.m_list.height = maxHeight;
  621. }
  622. if (selectItem)
  623. {
  624. int itemId = MyDressUpHelper.dressUpObj.GetItemIdBuyType(_currentMenuType);
  625. if (itemId > 0)
  626. {
  627. int index = _currentList3.IndexOf(itemId);
  628. if (index >= 0 && index < _ui.m_partsList.m_list.numItems)
  629. {
  630. _ui.m_partsList.m_list.ScrollToView(index);
  631. }
  632. }
  633. }
  634. currentListType = DressUpListType.List3;
  635. GTween.To(_ui.target.width, partsListX, 0.5f)
  636. .SetTarget(_ui.m_partsList)
  637. .OnUpdate((GTweener t) =>
  638. {
  639. _ui.m_partsList.target.x = t.value.x;
  640. });
  641. UpdateListPartsSelected();
  642. return true;
  643. }
  644. private void OnComboBoxRarityChanged()
  645. {
  646. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  647. this.UpdatePartsListSort();
  648. }
  649. private void OnSearchComboBoxRarityChanged()
  650. {
  651. _scoreIndex = _ui.m_partsListSearch.m_comboBoxRarity.selectedIndex;
  652. this.UpdateSearchList();
  653. }
  654. private void UpdatePartsListSort()
  655. {
  656. if (_currentMenuType == 0) return;
  657. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  658. {
  659. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  660. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  661. {
  662. _currentList3 = SuitUtil.SortSuitListByHighScore(_currentList3);
  663. }
  664. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  665. {
  666. _currentList3 = SuitUtil.SortSuitListByLowScore(_currentList3);
  667. }
  668. else
  669. {
  670. _currentList3.Reverse();
  671. }
  672. }
  673. else
  674. {
  675. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  676. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  677. {
  678. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3, true);
  679. }
  680. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  681. {
  682. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3, true);
  683. }
  684. else
  685. {
  686. _currentList3.Reverse();
  687. }
  688. }
  689. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  690. // {
  691. // _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
  692. // }
  693. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  694. // {
  695. // _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
  696. // }
  697. //必穿品放在列表最前面
  698. if (_fightCfg.needItemId > 0)
  699. {
  700. int index = _currentList3.IndexOf(_fightCfg.needItemId);
  701. if (index >= 0)
  702. {
  703. int item = _currentList3[index];
  704. _currentList3.Remove(_currentList3[index]);
  705. _currentList3.Insert(0, item);
  706. }
  707. }
  708. else if (_fightCfg.needSuitId > 0)
  709. {
  710. int index = _currentList3.IndexOf(_fightCfg.needSuitId);
  711. if (index >= 0)
  712. {
  713. int item = _currentList3[index];
  714. _currentList3.Remove(_currentList3[index]);
  715. _currentList3.Insert(0, item);
  716. }
  717. }
  718. _ui.m_partsList.m_list.RemoveChildrenToPool();
  719. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  720. }
  721. private void UpdateSuitPartsListSort()
  722. {
  723. if (_currentMenuType == 0) return;
  724. _currentList4 = new List<int>(SuitCfgArray.Instance.GetSuitItems(_currentSuitId, true));
  725. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  726. // {
  727. // _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4);
  728. // }
  729. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  730. // {
  731. // _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4);
  732. // }
  733. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  734. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  735. }
  736. private void hideListParts()
  737. {
  738. GTween.To(partsListX, _ui.target.width, 0.5f)
  739. .SetTarget(_ui.m_partsList)
  740. .OnUpdate((GTweener t) =>
  741. {
  742. _ui.m_partsList.target.x = t.value.x;
  743. });
  744. }
  745. private void showListParts2(int suitId)
  746. {
  747. _currentSuitId = suitId;
  748. _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  749. this.UpdateSuitPartsListSort();
  750. _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
  751. float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
  752. if (_ui.m_partsList2.m_list.height > maxHeight)
  753. {
  754. _ui.m_partsList2.m_list.height = maxHeight;
  755. }
  756. currentListType = DressUpListType.List4;
  757. GTween.To(_ui.target.width, partsListX, 0.5f)
  758. .SetTarget(_ui.m_partsList2)
  759. .OnUpdate((GTweener t) =>
  760. {
  761. _ui.m_partsList2.target.x = t.value.x;
  762. });
  763. }
  764. private void hideListParts2()
  765. {
  766. _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
  767. GTween.To(partsListX, _ui.target.width, 0.5f)
  768. .SetTarget(_ui.m_partsList2)
  769. .OnUpdate((GTweener t) =>
  770. {
  771. _ui.m_partsList2.target.x = t.value.x;
  772. });
  773. }
  774. private void showSearchListType()
  775. {
  776. // _currentList2 = null;
  777. currentListType = DressUpListType.List5;
  778. GTween.To(_ui.target.width, partsListX, 0.5f)
  779. .SetTarget(_ui.m_partsListSearch.target)
  780. .OnUpdate((GTweener t) =>
  781. {
  782. _ui.m_partsListSearch.target.x = t.value.x;
  783. });
  784. }
  785. private void hideSearchListType()
  786. {
  787. GTween.To(partsListX, _ui.target.width, 0.5f)
  788. .SetTarget(_ui.m_partsListSearch.target)
  789. .OnUpdate((GTweener t) =>
  790. {
  791. _ui.m_partsListSearch.target.x = t.value.x;
  792. });
  793. }
  794. /*****************************************************************************************************/
  795. private void DressResetSerch()
  796. {
  797. if (currentListType == DressUpListType.List5)
  798. {
  799. OnTouchPad();
  800. }
  801. }
  802. private void UpdateSerch(EventContext context)
  803. {
  804. if (context.data.ToString() == ConstMessage.DRESS_SEARCH)
  805. {
  806. _currentList3 = DressUpMenuItemDataManager.DressSearch(false);
  807. }
  808. else if (context.data.ToString() == ConstMessage.DRESS_FILTER)
  809. {
  810. _currentList3 = DressUpMenuItemDataManager.DressFilter(false);
  811. }
  812. ViewManager.Hide<ModalStatusView>();
  813. UpdateSearchList();
  814. if (currentListType != DressUpListType.List5)
  815. {
  816. hideListParts();
  817. hideListParts2();
  818. hideListType1();
  819. hideListType2();
  820. showSearchListType();
  821. }
  822. _currentMenuType = 0;
  823. }
  824. private void UpdateSearchList()
  825. {
  826. if (_scoreIndex == SORT_BY_HIGH_SCORE)
  827. {
  828. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighScore(_currentList3, true);
  829. }
  830. else if (_scoreIndex == SORT_BY_LOW_SCORE)
  831. {
  832. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowScore(_currentList3, true);
  833. }
  834. _currentMenuType = 0;
  835. _ui.m_partsListSearch.m_list.numItems = _currentList3.Count; ;
  836. }
  837. private void ListType1Item(int index, GObject item)
  838. {
  839. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  840. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
  841. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
  842. typeItem.m_txtname.text = item1.name;
  843. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  844. typeItem.target.data = item1.id;
  845. typeItem.m_imgNeed.visible = ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, item1.id);
  846. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.id);
  847. UI_TypeItem.ProxyEnd();
  848. }
  849. private void ListType2Item(int index, GObject item)
  850. {
  851. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  852. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
  853. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
  854. typeItem.m_txtname.text = item2.name;
  855. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  856. typeItem.target.data = item2.id;
  857. var subType = ItemUtilCS.GetItemSubType(_fightCfg.needItemId);
  858. typeItem.m_imgNeed.visible = subType == item2.type;
  859. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.id);
  860. UI_TypeItem.ProxyEnd();
  861. }
  862. private void ListPartsItem(int index, GObject item)
  863. {
  864. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  865. int id = (int)_currentList3[index];
  866. string iconRes = "";
  867. string partName = "";
  868. string ext = "png";
  869. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  870. {
  871. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  872. iconRes = suitCfg.res;
  873. partName = suitCfg.name;
  874. listItem.m_iconSelected.visible = false;
  875. listItem.m_txtScore.text = "" + SuitUtil.GetSuitScore(id);
  876. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  877. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.rarity;
  878. listItem.m_imgNew.visible = false;
  879. }
  880. else
  881. {
  882. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  883. iconRes = itemCfg.res;
  884. partName = itemCfg.name;
  885. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  886. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, InstanceZonesDataManager.currentScoreType, _fightCfg.needTagsArr);
  887. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  888. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  889. listItem.m_imgNew.visible = isNew;
  890. if (isNew)
  891. {
  892. ItemProxy.ReqSetItemRead(id).Coroutine();
  893. }
  894. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  895. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  896. }
  897. if (listItem.target.data == null)
  898. {
  899. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  900. longPressGesture.once = true;
  901. longPressGesture.onAction.Add(OnLongPress);
  902. _listLongPress.Add(longPressGesture);
  903. }
  904. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  905. listItem.m_ScoreType.url = "ui://CommonGame/kp_sx_" + _fightCfg.scoreType;
  906. listItem.m_txtTitle.text = partName;
  907. listItem.target.data = id;
  908. listItem.m_imgNeed.visible = _fightCfg.needItemId == id || _fightCfg.needSuitId == id;
  909. UI_PartsListItem.ProxyEnd();
  910. }
  911. private void ListParts2Item(int index, GObject item)
  912. {
  913. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  914. int id = (int)_currentList4[index];
  915. string iconRes = "";
  916. string partName = "";
  917. string ext = "png";
  918. if (listItem.target.data == null)
  919. {
  920. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  921. longPressGesture.once = true;
  922. longPressGesture.onAction.Add(OnLongPress);
  923. _listLongPress.Add(longPressGesture);
  924. }
  925. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  926. iconRes = itemCfg.res;
  927. partName = itemCfg.name;
  928. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  929. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  930. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  931. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  932. listItem.m_ScoreType.visible = true;
  933. // int mainScore;
  934. // int mainValuel;
  935. // ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
  936. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + _fightCfg.scoreType);
  937. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, _fightCfg.scoreType, _fightCfg.needTagsArr);
  938. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  939. listItem.m_txtTitle.text = partName;
  940. listItem.target.data = id;
  941. // listItem.m_txtScore.visible = false;
  942. //listItem.m_ScoreType.visible = true;
  943. listItem.m_imgNeed.visible = false;
  944. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  945. listItem.m_imgNew.visible = isNew;
  946. if (isNew)
  947. {
  948. ItemProxy.ReqSetItemRead(id).Coroutine();
  949. }
  950. UI_PartsListItem.ProxyEnd();
  951. }
  952. private void UpdateListPartsSelected()
  953. {
  954. int count = _ui.m_partsList.m_list.numChildren;
  955. int suitId = MyDressUpHelper.dressUpObj.suitId;
  956. for (int i = 0; i < count; i++)
  957. {
  958. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(i));
  959. int id = (int)listItem.target.data;
  960. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  961. {
  962. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  963. }
  964. else
  965. {
  966. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  967. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  968. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  969. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  970. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  971. }
  972. UI_PartsListItem.ProxyEnd();
  973. }
  974. }
  975. private void UpdateSearchListPartsSelected()
  976. {
  977. int count = _ui.m_partsListSearch.m_list.numChildren;
  978. int suitId = MyDressUpHelper.dressUpObj.suitId;
  979. for (int i = 0; i < count; i++)
  980. {
  981. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsListSearch.m_list.GetChildAt(i));
  982. int id = (int)listItem.target.data;
  983. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  984. {
  985. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  986. }
  987. else
  988. {
  989. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  990. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  991. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  992. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  993. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  994. }
  995. UI_PartsListItem.ProxyEnd();
  996. }
  997. }
  998. private void UpdateListSuitPartsSelected()
  999. {
  1000. int count = _ui.m_partsList2.m_list.numChildren;
  1001. int suitId = MyDressUpHelper.dressUpObj.suitId;
  1002. for (int i = 0; i < count; i++)
  1003. {
  1004. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  1005. int id = (int)listItem.target.data;
  1006. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  1007. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  1008. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  1009. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  1010. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  1011. UI_PartsListItem.ProxyEnd();
  1012. }
  1013. }
  1014. private void ShowTaskHint()
  1015. {
  1016. _ui.m_btnClose.visible = true;
  1017. _ui.m_grpTips.visible = true;
  1018. _ui.m_txtHint.text = _levelCfg.hint;
  1019. if (this._ui.m_txtHint.textHeight > this._ui.m_txtHint.textFormat.size * 2)
  1020. {
  1021. this._ui.m_txtHint.align = AlignType.Left;
  1022. }
  1023. else
  1024. {
  1025. this._ui.m_txtHint.align = AlignType.Center;
  1026. }
  1027. }
  1028. private void UpdateScore()
  1029. {
  1030. _ui.m_txtScore.text = "" + FightDataManager.Instance.GetScore(InstanceZonesDataManager.roleData).ToString();
  1031. // GuideController.TryGuideDressUpFightViewBtnNext(_ui.m_btnNext);
  1032. }
  1033. private void OnClickBtnSearch()
  1034. {
  1035. ViewManager.Show<DressFilterView>(false, new object[] { ViewName.DRESS_UP_VIEW });
  1036. }
  1037. private void OnClickBtnAutoPlay()
  1038. {
  1039. FightDataManager.Instance.autoPlay = _ui.m_btnAutoPlay.selected;
  1040. }
  1041. private void OnClickComNeed()
  1042. {
  1043. if (_fightCfg.needItemId <= 0 && _fightCfg.needSuitId <= 0)
  1044. {
  1045. return;
  1046. }
  1047. if (_fightCfg.needSuitId > 0)
  1048. {
  1049. ViewManager.Show<SuitPartsDetailView>(_fightCfg.needSuitId, new object[] { typeof(DressUpFightView).FullName, this.viewData });
  1050. }
  1051. else
  1052. {
  1053. int itemId = (int)_ui.m_compNeed.target.data;
  1054. object[] sourceDatas = new object[] { itemId, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData }, 1 };
  1055. GoodsItemTipsController.ShowItemTips(itemId, sourceDatas);
  1056. }
  1057. }
  1058. private void RenderListTagItem(int index, GObject obj)
  1059. {
  1060. UI.CommonGame.UI_ComTag item = UI.CommonGame.UI_ComTag.Proxy(obj);
  1061. string tag = _fightCfg.needTagsArr[index];
  1062. int tagType = TagCfgArray.Instance.GetCfg(tag).type;
  1063. item.m_txtTag.text = tag;
  1064. item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
  1065. UI.CommonGame.UI_ComTag.ProxyEnd();
  1066. }
  1067. private bool CheckListCount(int type)
  1068. {
  1069. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  1070. {
  1071. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  1072. }
  1073. else
  1074. {
  1075. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  1076. }
  1077. }
  1078. private void SendLog()
  1079. {
  1080. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  1081. switch (levelCfg.type)
  1082. {
  1083. case ConstInstanceZonesType.Story:
  1084. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CHUN_ZHONG_LOU, 2);
  1085. break;
  1086. case ConstInstanceZonesType.Studio:
  1087. StudioCfg studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
  1088. if (studioCfg.funId == typeof(StudioMetalView).Name)
  1089. {
  1090. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 2);
  1091. }
  1092. else if (studioCfg.funId == typeof(StudioFabricView).Name)
  1093. {
  1094. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 2);
  1095. }
  1096. else if (studioCfg.funId == typeof(StudioPropertyView).Name)
  1097. {
  1098. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 2);
  1099. }
  1100. break;
  1101. }
  1102. }
  1103. private void CheckGuide(object param)
  1104. {
  1105. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0
  1106. || GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0
  1107. || GuideDataManager.IsGuideFinish(ConstGuideId.AUTOPLAY_FIGHT) <= 0)
  1108. {
  1109. UpdateToCheckGuide(null);
  1110. }
  1111. else
  1112. {
  1113. Timers.inst.Remove(CheckGuide);
  1114. }
  1115. _ui.m_loaGuide.visible = false;
  1116. }
  1117. protected override void UpdateToCheckGuide(object param)
  1118. {
  1119. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  1120. int buyClothingIndex = 0;
  1121. int buyClothingSubIndex = 0;
  1122. int taozhuangIndex = 0;
  1123. int len = _ui.m_comListType1.m_listType.numChildren;
  1124. for (int i = 0; i < len; i++)
  1125. {
  1126. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  1127. if (item != null)
  1128. {
  1129. int menuID = (int)item.target.data;
  1130. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  1131. if (GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0 && dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  1132. {
  1133. taozhuangIndex = i;
  1134. break;
  1135. }
  1136. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0 && _fightCfg.needItemId > 0 && ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, dressUpMenuItemCfg1.id))
  1137. {
  1138. buyClothingIndex = i;
  1139. break;
  1140. }
  1141. }
  1142. UI_TypeItem.ProxyEnd();
  1143. }
  1144. buyClothingSubIndex = _currentList3.IndexOf(_fightCfg.needItemId);
  1145. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.START_FIGHT, 3, "点击相应的分类,可以快速找到服饰。", taozhuangIndex);
  1146. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.START_FIGHT, 4, "", 0);
  1147. GuideController.TryGuide(_ui.m_btnNext, ConstGuideId.START_FIGHT, 5, "穿着完毕,来验证一下,换上的服饰是否符合需求。");
  1148. // GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
  1149. GuideController.TryGuide(_ui.m_compNeed.target, ConstGuideId.BUY_CLOTHING, 3, "当提示有“必需品”时,需要穿上对应物品才能通关。");
  1150. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.BUY_CLOTHING, 7, "按照指示就可以找到必需品啦,点击换上吧。", buyClothingIndex);
  1151. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.BUY_CLOTHING, 8, "", buyClothingSubIndex);
  1152. GuideController.TryCompleteGuide(ConstGuideId.BUY_CLOTHING, 8);
  1153. GuideController.TryGuide(_ui.m_btnHint, ConstGuideId.FIGHT_TIPS, 1, "这次换装需要获得别人的认可呢。");
  1154. GuideController.TryCompleteGuide(ConstGuideId.FIGHT_TIPS, 1);
  1155. GuideController.TryGuide(_ui.m_btnRecommend, ConstGuideId.AUTOPLAY_FIGHT, 1, "衣服太多难以选择,可以点击这里。");
  1156. GuideController.TryGuide(_ui.m_btnAutoPlay, ConstGuideId.AUTOPLAY_FIGHT, 2, "勾选后,自动进行比拼哦~~");
  1157. GuideController.TryCompleteGuide(ConstGuideId.AUTOPLAY_FIGHT, 2);
  1158. }
  1159. protected override void TryCompleteGuide()
  1160. {
  1161. base.TryCompleteGuide();
  1162. // GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
  1163. }
  1164. }
  1165. }