DressUpFightView.cs 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288
  1. using UI.DressUp;
  2. using FairyGUI;
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. using System;
  6. using ET;
  7. using System.Collections;
  8. namespace GFGGame
  9. {
  10. public class DressUpFightView : BaseView
  11. {
  12. private UI_DressUpFightUI _ui;
  13. private int _fightID;
  14. private int _levelID;
  15. private float listType1X = 0;
  16. private float partsListX = 0;
  17. private float partsListScrollingPosY = 0;
  18. private DressUpListType currentListType;
  19. private int[] _currentList2;
  20. private GameObject _scenePrefab;
  21. private GameObject _sceneObject;
  22. private List<int> _currentList3 = new List<int>();
  23. private List<int> _currentList4 = new List<int>();
  24. private int _currentMenuType;
  25. private int _currentSuitId;
  26. private StoryLevelCfg _levelCfg;
  27. private StoryFightCfg _fightCfg;
  28. private const int SORT_BY_HIGH_SCORE = 0;
  29. private const int SORT_BY_LOW_SCORE = 1;
  30. private int _scoreIndex = SORT_BY_HIGH_SCORE;
  31. private List<LongPressGesture> _listLongPress = new List<LongPressGesture>();
  32. public override void Dispose()
  33. {
  34. if (_sceneObject != null)
  35. {
  36. GameObject.Destroy(_sceneObject);
  37. _sceneObject = null;
  38. }
  39. for (int i = 0; i < _listLongPress.Count; i++)
  40. {
  41. _listLongPress[i].Dispose();
  42. }
  43. if (_ui != null)
  44. {
  45. _ui.Dispose();
  46. _ui = null;
  47. }
  48. base.Dispose();
  49. }
  50. protected override void Init()
  51. {
  52. base.Init();
  53. packageName = UI_DressUpFightUI.PACKAGE_NAME;
  54. _ui = UI_DressUpFightUI.Create();
  55. viewCom = _ui.target;
  56. isfullScreen = true;
  57. _scenePrefab = GFGAsset.Load<GameObject>(ResPathUtil.GetPrefabPath("SceneDressUpFight"));
  58. _ui.m_btnClose.width = GRoot.inst.width;
  59. _ui.m_btnClose.height = GRoot.inst.height;
  60. _ui.m_btnClose.AddRelation(GRoot.inst, RelationType.Size);
  61. }
  62. protected override void OnInit()
  63. {
  64. base.OnInit();
  65. _ui.m_btnLastStep.visible = true;
  66. _ui.m_btnNextStep.visible = true;
  67. _ui.m_btnClose.visible = false;
  68. _ui.m_grpTips.visible = false;
  69. _ui.m_btnRepeal.visible = false;
  70. _ui.m_btnRenewal.visible = false;
  71. _ui.m_btnSearch.visible = true;
  72. // _ui.m_comboBox.items = new string[] { "我的套装一", "我的套装二", "我的套装三", "我的套装四", "我的套装五", "我的套装六" };
  73. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高分优先", "低分优先" };
  74. _ui.m_partsListSearch.m_comboBoxRarity.items = new string[] { "高分优先", "低分优先" };
  75. InitLists();
  76. _ui.m_partsList.m_comboBoxRarity.onChanged.Add(OnComboBoxRarityChanged);
  77. _ui.m_partsListSearch.m_comboBoxRarity.onChanged.Add(OnSearchComboBoxRarityChanged);
  78. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  79. _ui.m_btnHome.onClick.Add(OnClickBtnHome);
  80. // _ui.m_btnClothingShop.onClick.Add(OnClickBtnClothingShop);
  81. // _ui.m_comboBox.onChanged.Add(OnComboBoxChanged);
  82. _ui.m_comListType1.m_listType.onClickItem.Add(OnClickListType1Item);
  83. _ui.m_comListType2.m_listType.onClickItem.Add(OnClickListType2Item);
  84. _ui.m_partsList.m_list.onClickItem.Add(OnClickPartsListItem);
  85. _ui.m_partsList2.m_list.onClickItem.Add(OnClickSuitPartsListItem);
  86. _ui.m_partsListSearch.m_list.onClickItem.Add(OnClickSearchPartsListItem);
  87. _ui.m_touchPad.onClick.Add(OnTouchPad);
  88. _ui.m_btnHint.onClick.Add(OnClickBtnHint);
  89. // _ui.m_btnGuide.onClick.Add(OnTouchPad);
  90. _ui.m_btnClose.onClick.Add(OnClickBtnClose);
  91. _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
  92. _ui.m_btnNext.onClick.Add(OnClickBtnNext);
  93. _ui.m_btnRecommend.onClick.Add(OnClickBtnRecommend);
  94. _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
  95. _ui.m_btnAutoPlay.onClick.Add(OnClickBtnAutoPlay);
  96. _ui.m_btnLastStep.onClick.Add(OnClickBtnLastStep);
  97. _ui.m_btnNextStep.onClick.Add(OnClickBtnNextStep);
  98. _ui.m_compNeed.target.onClick.Add(OnClickComNeed);
  99. _ui.m_compNeed.m_listTag.itemRenderer = RenderListTagItem;
  100. // _ui.m_btnShow.onClick.Add(OnClickBtnShow);
  101. // _ui.m_btnHide.onClick.Add(OnClickBtnHide);
  102. // _ui.m_loaShow.onClick.Add(OnClickLoaShow);
  103. // _ui.m_btnHide.visible = false;
  104. // EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdatePartsListSort);
  105. _ui.m_partsList2.m_comboBoxRarity.visible = false;
  106. _ui.m_partsList2.m_imgTop.visible = true;
  107. _ui.m_partsList.m_imgTop.visible = false;
  108. }
  109. protected override void AddEventListener()
  110. {
  111. base.AddEventListener();
  112. EventAgent.AddEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
  113. EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, UpdateSerch);
  114. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdateSerch);
  115. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
  116. // EventAgent.AddEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
  117. }
  118. protected override void OnShown()
  119. {
  120. base.OnShown();
  121. _ui.m_loaGuide.visible = true;
  122. InstanceZonesDataManager.usedRecommend = false;
  123. // _ui.m_comboBox.title = "我的套装";
  124. _ui.m_txtRecommendCount.SetVar("v1", "" + GameGlobal.myNumericComponent.GetAsInt(ET.NumericType.RecommendCount)).FlushVars();
  125. _ui.m_txtRecommendCount.SetVar("v2", GlobalCfgArray.globalCfg.recommendCount.ToString()).FlushVars();
  126. _scoreIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  127. _ui.m_btnAutoPlay.selected = FightDataManager.Instance.autoPlay;
  128. _ui.m_btnAutoPlay.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.FUNCTION_AUTOPLAY_FIGHT, false);
  129. _ui.m_btnRecommend.visible = FunctionOpenDataManager.Instance.CheckIsFunOpenById(ConstFunctionId.FUNCTION_AUTOPLAY_FIGHT, false); ;
  130. _levelID = (int)viewData;
  131. InstanceZonesDataManager.currentLevelCfgId = _levelID;
  132. _levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  133. _fightCfg = StoryFightCfgArray.Instance.GetCfg(_levelCfg.fightID);
  134. if (_levelCfg.type == ConstInstanceZonesType.Field)
  135. {
  136. _fightCfg.scoreType = FieldDataManager.Instance.fieldInfos.theme;
  137. _ui.m_btnAutoPlay.visible = false;
  138. }
  139. InstanceZonesDataManager.FightScene = _levelCfg.type;
  140. _ui.m_compNeed.target.visible = _fightCfg.needItemId > 0 || _fightCfg.needSuitId > 0 || _fightCfg.needTagsArr.Length > 0;
  141. if (_ui.m_compNeed.target.visible)
  142. {
  143. _ui.m_compNeed.m_c1.selectedIndex = 0;
  144. if (_fightCfg.needItemId > 0)
  145. {
  146. _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetItemName(_fightCfg.needItemId);
  147. _ui.m_compNeed.target.data = _fightCfg.needItemId;
  148. _ui.m_compNeed.m_imgGot.visible = ItemDataManager.GetItemNum(_fightCfg.needItemId) > 0;
  149. }
  150. else if (_fightCfg.needSuitId > 0)
  151. {
  152. _ui.m_compNeed.m_txtNeedName.text = ItemUtil.GetSuitName(_fightCfg.needSuitId);
  153. _ui.m_compNeed.target.data = _fightCfg.needSuitId;
  154. _ui.m_compNeed.m_imgGot.visible = DressUpMenuSuitDataManager.CheckHaveSuit(_fightCfg.needSuitId);
  155. }
  156. else
  157. {
  158. _ui.m_compNeed.m_c1.selectedIndex = 1;
  159. _ui.m_compNeed.m_listTag.numItems = _fightCfg.needTagsArr.Length;
  160. _ui.m_compNeed.m_imgGot.visible = false;
  161. }
  162. }
  163. InstanceZonesDataManager.currentScoreType = _fightCfg.scoreType;
  164. //一级菜单
  165. _ui.m_comListType1.m_listType.RemoveChildrenToPool();
  166. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
  167. //_ui.m_comListType1.m_listType1.ResizeToFit(_ui.m_listType1.numItems);
  168. float maxHeight = _ui.target.height - _ui.m_comListType1.m_listType.y - DressUpView.BOTTOM_BLANK;
  169. if (_ui.m_comListType1.m_listType.height > maxHeight)
  170. {
  171. _ui.m_comListType1.m_listType.height = maxHeight;
  172. }
  173. _ui.m_comListType1.target.x = _ui.target.width;
  174. _ui.m_comListType2.target.x = _ui.target.width;
  175. _ui.m_partsList.target.x = _ui.target.width;
  176. _ui.m_partsList2.target.x = _ui.target.width;
  177. _ui.m_scoreType.url = "ui://CommonGame/kp_sx_" + _fightCfg.scoreType;
  178. this.showListType1();
  179. if (_sceneObject == null)
  180. {
  181. _sceneObject = GameObject.Instantiate(_scenePrefab);
  182. MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, false);
  183. MyDressUpHelper.dressUpObj.PutOnDefaultDressUpData();
  184. }
  185. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  186. UpdateStepBtn(true);
  187. UpdateScore();
  188. SendLog();
  189. Timers.inst.AddUpdate(CheckGuide);
  190. }
  191. protected override void OnHide()
  192. {
  193. base.OnHide();
  194. _ui.m_btnClose.visible = false;
  195. _ui.m_grpTips.visible = false;
  196. if (_sceneObject != null)
  197. {
  198. GameObject.Destroy(_sceneObject);
  199. _sceneObject = null;
  200. }
  201. _fightCfg = null;
  202. _levelCfg = null;
  203. DressUpMenuItemDataManager.Clear();
  204. MyDressUpHelper.ResetMemory();
  205. Timers.inst.Remove(CheckGuide);
  206. }
  207. protected override void RemoveEventListener()
  208. {
  209. base.RemoveEventListener();
  210. EventAgent.RemoveEventListener(ConstMessage.CARD_CHOOSE, StartCalculateScore);
  211. EventAgent.RemoveEventListener(ConstMessage.DRESS_SEARCH, UpdateSerch);
  212. EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, UpdateSerch);
  213. EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
  214. // EventAgent.RemoveEventListener(ConstMessage.DRESS_UP_SCORE_CHANGED, UpdateScore);
  215. }
  216. private void OnClickBtnLastStep()
  217. {
  218. if (!MyDressUpHelper.OnClickBtnLastStep()) return;
  219. UpdateStepBtn(false);
  220. }
  221. private void OnClickBtnNextStep()
  222. {
  223. if (!MyDressUpHelper.OnClickBtnNextStep()) return;
  224. UpdateStepBtn(false);
  225. }
  226. private void OnClickBtnBack()
  227. {
  228. AlertUI.Show("是否确定退出?")
  229. .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
  230. {
  231. if (_levelCfg.type == ConstInstanceZonesType.Studio && _levelCfg.subType != ConstInstanceZonesSubType.Hard3)
  232. {
  233. ViewManager.Show(StudioDataManager.Instance.VIEW_NAME, StudioDataManager.Instance.PROPERTY_SELECT_INDEX, ViewManager.GetGoBackDatas(StudioDataManager.Instance.VIEW_NAME));
  234. }
  235. else if (_levelCfg.type == ConstInstanceZonesType.Studio && _levelCfg.subType == ConstInstanceZonesSubType.Hard3)
  236. {
  237. ViewManager.Show<StudioFilingView>(null, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName));
  238. }
  239. else if (_levelCfg.type == ConstInstanceZonesType.Field)
  240. {
  241. ViewManager.GoBackFrom(ViewName.DRESS_UP_FIGHT_VIEW);
  242. }
  243. else
  244. {
  245. // ViewManager.GoBackFrom(ViewName.STORY_CHAPTER_VIEW);
  246. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, _levelCfg.chapterId);//, new object[] { ViewName.STORY_CHAPTER_LIST_VIEW }
  247. }
  248. //MyDressUpHelper.dressUpObj.TakeOffAll();
  249. this.Hide();
  250. });
  251. // ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter);
  252. }
  253. private void OnClickBtnHome()
  254. {
  255. AlertUI.Show("是否返回?")
  256. .SetLeftButton(true, "否").SetRightButton(true, "是", (object data) =>
  257. {
  258. //MyDressUpHelper.dressUpObj.TakeOffAll();
  259. GameController.GoBackToMainView();
  260. });
  261. }
  262. private void OnClickBtnClothingShop()
  263. {
  264. ViewManager.Show(ViewName.CLOTHING_SHOP_VIEW, new object[] { null, _fightCfg.scoreType }, null, false, true);
  265. }
  266. private void OnClickListType1Item(EventContext context)
  267. {
  268. // GuideController.HideGuide();
  269. GObject typeItem = context.data as GObject;
  270. int order = (int)typeItem.data;
  271. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[order - 1];
  272. if (item1.subMenusArr.Length > 0)
  273. {
  274. this.showListType2(item1.subMenusArr);
  275. }
  276. else
  277. {
  278. if (this.showListParts(item1.type) == false)
  279. {
  280. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  281. return;
  282. }
  283. this.showListParts(item1.type);
  284. }
  285. this.hideListType1();
  286. UpdateListPartsSelected();
  287. }
  288. private void OnClickListType2Item(EventContext context)
  289. {
  290. GObject typeItem = context.data as GObject;
  291. int order = (int)typeItem.data;
  292. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[order - 1];
  293. if (this.showListParts(item2.type) == false)
  294. {
  295. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  296. return;
  297. }
  298. this.hideListType2();
  299. }
  300. private void OnClickSearchPartsListItem(EventContext context)
  301. {
  302. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  303. {
  304. return;
  305. }
  306. GObject listItem = context.data as GObject;
  307. int id = (int)listItem.data;
  308. bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
  309. bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  310. bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
  311. bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
  312. if (isOrnament && !isDress && !isHasSame && isMaxCount)
  313. {
  314. PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
  315. return;
  316. }
  317. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  318. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  319. UpdateSearchListPartsSelected();
  320. UpdateScore();
  321. }
  322. private void OnClickPartsListItem(EventContext context)
  323. {
  324. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  325. {
  326. return;
  327. }
  328. GObject listItem = context.data as GObject;
  329. int id = (int)listItem.data;
  330. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  331. {
  332. partsListScrollingPosY = _ui.m_partsList.m_list.scrollPane.scrollingPosY;
  333. this.showListParts2(id);
  334. this.hideListParts();
  335. MyDressUpHelper.dressUpObj.PutOnItemList(MyDressUpHelper.GetSuitFightItems(id));
  336. UpdateStepBtn(true);
  337. // MyDressUpHelper.dressUpObj.PutOnSuitCfg(id, false);
  338. }
  339. else
  340. {
  341. bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
  342. bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  343. bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
  344. bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
  345. if (isOrnament && !isDress && !isHasSame && isMaxCount)
  346. {
  347. PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
  348. return;
  349. }
  350. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  351. UpdateStepBtn(true);
  352. }
  353. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  354. // UpdateListPartsSelected();
  355. // UpdateListSuitPartsSelected();
  356. UpdateScore();
  357. }
  358. private void OnClickSuitPartsListItem(EventContext context)
  359. {
  360. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  361. {
  362. return;
  363. }
  364. GObject listItem = (GObject)context.data as GObject;
  365. int id = (int)listItem.data;
  366. bool isOrnament = DressUpMenuItemCfg1Array.Instance.CheckIsOrnamentsType(id);
  367. bool isDress = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  368. bool isHasSame = MyDressUpHelper.dressUpObj.CheckSameTypeIsOn(id);
  369. bool isMaxCount = MyDressUpHelper.GetCurrentOrnamentCount() >= GlobalCfgArray.globalCfg.dressLimitCount;
  370. if (isOrnament && !isDress && !isHasSame && isMaxCount)
  371. {
  372. PromptController.Instance.ShowFloatTextPrompt("饰品穿戴数量已达上限");
  373. return;
  374. }
  375. if (!DressUpMenuItemDataManager.CheckHasItem(id))
  376. {
  377. PromptController.Instance.ShowFloatTextPrompt("还未获得这件装扮");
  378. return;
  379. }
  380. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  381. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  382. UpdateStepBtn(true);
  383. // UpdateListSuitPartsSelected();
  384. UpdateScore();
  385. }
  386. private void UpdateStepBtn(bool isAdd, int suitId = 0)
  387. {
  388. if (isAdd)
  389. {
  390. MyDressUpHelper.AddMemoryDressup();
  391. }
  392. _ui.m_btnLastStep.enabled = MyDressUpHelper.stepIndex > 0;
  393. _ui.m_btnNextStep.enabled = MyDressUpHelper.stepIndex < MyDressUpHelper.dressMemory.Count - 1;
  394. UpdateListPartsSelected();
  395. UpdateListSuitPartsSelected();
  396. }
  397. private void OnLongPress(EventContext context)
  398. {
  399. LongPressGesture gesture = (LongPressGesture)context.sender;
  400. int itemId = (int)gesture.host.data;
  401. GoodsItemTipsController.ShowItemTips(itemId);
  402. }
  403. private void OnTouchPad()
  404. {
  405. if (this.currentListType == DressUpListType.List4)
  406. {
  407. this.hideListParts2();
  408. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  409. }
  410. else if (this.currentListType == DressUpListType.List3)
  411. {
  412. if (_currentList2 != null)
  413. {
  414. this.showListType2(_currentList2);
  415. }
  416. else
  417. {
  418. this.showListType1();
  419. }
  420. this.hideListParts();
  421. }
  422. else if (this.currentListType == DressUpListType.List2)
  423. {
  424. this.showListType1();
  425. this.hideListType2();
  426. }
  427. else if (this.currentListType == DressUpListType.List5)
  428. {
  429. this.showListType1();
  430. this.hideSearchListType();
  431. }
  432. }
  433. private void OnClickBtnHint()
  434. {
  435. this.ShowTaskHint();
  436. }
  437. private void OnClickBtnDelete()
  438. {
  439. MyDressUpHelper.dressUpObj.TakeOffAll();
  440. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  441. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  442. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  443. UpdateStepBtn(true);
  444. // UpdateListPartsSelected();
  445. // UpdateListSuitPartsSelected();
  446. }
  447. private void OnClickBtnClose()
  448. {
  449. _ui.m_btnClose.visible = false;
  450. _ui.m_grpTips.visible = false;
  451. }
  452. private void OnClickBtnNext()
  453. {
  454. if (!MyDressUpHelper.CheckPutOnFinish())
  455. {
  456. AlertUI.Show("只有换好衣服才能出门哦!")
  457. .SetRightButton(true, "好的");
  458. return;
  459. }
  460. if (!CheckHasNeed())
  461. {
  462. AlertUI.Show("未穿戴必需品。").SetRightButton(true, "好的");
  463. return;
  464. }
  465. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  466. if (RoleDataManager.power < levelCfg.power)
  467. {
  468. ItemUtil.AddPower(OnClickBtnPhotograph);
  469. return;
  470. }
  471. OnClickBtnPhotograph();
  472. }
  473. private bool CheckHasNeed()
  474. {
  475. int _suitId = MyDressUpHelper.dressUpObj.suitId;
  476. bool isNoSuit = _fightCfg.needSuitId > 0 && _suitId != _fightCfg.needSuitId;//需要套装但未穿套装
  477. bool isDressUpItem = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(_fightCfg.needItemId);
  478. bool isIncludeItem = _suitId > 0 && Array.IndexOf(SuitCfgArray.Instance.GetCfg(_suitId).partsArr, _fightCfg.needItemId) >= 0;
  479. bool isNoItem = _fightCfg.needItemId > 0 && !isDressUpItem && !isIncludeItem;
  480. if (isNoSuit || isNoItem)
  481. {
  482. return false;
  483. }
  484. return true;
  485. }
  486. private void OnClickBtnPhotograph()
  487. {
  488. Timers.inst.StartCoroutine(ScreenShotTex());
  489. }
  490. private IEnumerator ScreenShotTex()
  491. {
  492. GameObject Role = _sceneObject.transform.Find("Role").gameObject;
  493. GameObject CopyRoleParent = _sceneObject.transform.Find("CopyRole").gameObject;
  494. Transform CopyRole = CopyRoleParent.transform.Find("Role");
  495. if (CopyRole != null)
  496. {
  497. GameObject.DestroyImmediate(CopyRole.gameObject);
  498. }
  499. Transform transform = GameObject.Instantiate(Role, CopyRoleParent.transform.position, Quaternion.identity).transform;//实例化物体
  500. transform.parent = CopyRoleParent.transform;
  501. transform.name = "Role";
  502. GameObject gameObject = _sceneObject.transform.Find("FightCamera").gameObject;
  503. Camera camera = gameObject.GetComponent<Camera>();
  504. FightDataManager.Instance.RoleTextuex = FightDataManager.Instance.GetPrintscreenNTexture(camera);
  505. yield return new WaitForEndOfFrame();
  506. if (CardDataManager.GetCardListByRarity(0).Count > 0)
  507. {
  508. ViewManager.Show<StoryCardChoose>(_fightCfg.scoreType);
  509. }
  510. else
  511. {
  512. StartCalculateScore();
  513. }
  514. }
  515. private void StartCalculateScore()
  516. {
  517. //不可移动代码位置
  518. bool hasFightTarget = _fightCfg.targetName != null && _fightCfg.targetName.Length > 0;
  519. if (_levelCfg.type == ConstInstanceZonesType.Field)
  520. {
  521. FieldFightDataManager.Instance.CurrentCardId = InstanceZonesDataManager.currentCardId;
  522. FieldFightDataManager.Instance.CurrentScoreType = InstanceZonesDataManager.currentScoreType;
  523. FieldFightDataManager.Instance.currentLevelCfgId = InstanceZonesDataManager.currentLevelCfgId;
  524. }
  525. if (hasFightTarget)
  526. {
  527. ViewManager.Show(ViewName.STORY_FIGHT_TARGET_VIEW);
  528. }
  529. else
  530. {
  531. ViewManager.Show(ViewName.STORY_FIGHT_SINGLE_VIEW);
  532. }
  533. this.Hide();
  534. }
  535. private void OnClickBtnRecommend()
  536. {
  537. if (this.currentListType == DressUpListType.List4)
  538. {
  539. this.hideListParts2();
  540. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  541. }
  542. InstanceZonesDataManager.usedRecommend = true;
  543. // MyDressUpHelper.PutOnRecommendItems();
  544. MyDressUpHelper.PutOnRecommendItems2();
  545. _ui.m_txtDressLimit.text = string.Format("饰品穿戴限制:{0}/{1}", MyDressUpHelper.GetCurrentOrnamentCount(), GlobalCfgArray.globalCfg.dressLimitCount);
  546. UpdateStepBtn(true);
  547. // UpdateListPartsSelected();
  548. // UpdateListSuitPartsSelected();
  549. UpdateScore();
  550. if (!CheckHasNeed())
  551. {
  552. PromptController.Instance.ShowFloatTextPrompt("未拥有必需品");
  553. }
  554. }
  555. private void InitLists()
  556. {
  557. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  558. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  559. _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
  560. _ui.m_partsListSearch.m_list.itemRenderer = ListPartsItem;
  561. listType1X = _ui.m_comListType1.target.x;
  562. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width;
  563. //一级菜单
  564. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  565. }
  566. private void showListType1()
  567. {
  568. _currentList2 = null;
  569. currentListType = DressUpListType.List1;
  570. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
  571. GTween.To(_ui.target.width, listType1X, 0.5f)
  572. .SetTarget(_ui.m_comListType1.target)
  573. .OnUpdate((GTweener t) =>
  574. {
  575. _ui.m_comListType1.target.x = t.value.x;
  576. });
  577. }
  578. private void hideListType1()
  579. {
  580. GTween.To(listType1X, _ui.target.width, 0.5f)
  581. .SetTarget(_ui.m_comListType1.target)
  582. .OnUpdate((GTweener t) =>
  583. {
  584. _ui.m_comListType1.target.x = t.value.x;
  585. });
  586. }
  587. private void showListType2(int[] menuStrArr = null)
  588. {
  589. currentListType = DressUpListType.List2;
  590. if (menuStrArr != null && menuStrArr.Length > 0)
  591. {
  592. int len = menuStrArr.Length;
  593. _currentList2 = menuStrArr.Clone() as int[];
  594. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  595. _ui.m_comListType2.m_listType.numItems = len;
  596. //_ui.m_listType2.ResizeToFit(_ui.m_listType2.numItems);
  597. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  598. if (_ui.m_comListType2.m_listType.height > maxHeight)
  599. {
  600. _ui.m_comListType2.m_listType.height = maxHeight;
  601. }
  602. }
  603. GTween.To(_ui.target.width, listType1X, 0.5f)
  604. .SetTarget(_ui.m_comListType2.target)
  605. .OnUpdate((GTweener t) =>
  606. {
  607. _ui.m_comListType2.target.x = t.value.x;
  608. });
  609. }
  610. private void hideListType2()
  611. {
  612. GTween.To(listType1X, _ui.target.width, 0.5f)
  613. .SetTarget(_ui.m_comListType2.target)
  614. .OnUpdate((GTweener t) =>
  615. {
  616. _ui.m_comListType2.target.x = t.value.x;
  617. });
  618. }
  619. private bool showListParts(int type, bool selectItem = false)
  620. {
  621. _currentMenuType = type;
  622. UpdatePartsListSort();
  623. if (_ui.m_partsList.m_list.numItems <= 0) return false;
  624. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  625. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;
  626. if (_ui.m_partsList.m_list.height > maxHeight)
  627. {
  628. _ui.m_partsList.m_list.height = maxHeight;
  629. }
  630. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  631. {
  632. _ui.m_partsList.m_list.scrollPane.SetPosY(partsListScrollingPosY, false);
  633. partsListScrollingPosY = 0;
  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_btnAni.visible = false;
  906. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  907. listItem.m_ScoreType.url = "ui://CommonGame/kp_sx_" + _fightCfg.scoreType;
  908. listItem.m_txtTitle.text = partName;
  909. listItem.target.data = id;
  910. listItem.m_imgNeed.visible = _fightCfg.needItemId == id || _fightCfg.needSuitId == id;
  911. UI_PartsListItem.ProxyEnd();
  912. }
  913. private void ListParts2Item(int index, GObject item)
  914. {
  915. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  916. int id = (int)_currentList4[index];
  917. string iconRes = "";
  918. string partName = "";
  919. string ext = "png";
  920. if (listItem.target.data == null)
  921. {
  922. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  923. longPressGesture.once = true;
  924. longPressGesture.onAction.Add(OnLongPress);
  925. _listLongPress.Add(longPressGesture);
  926. }
  927. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  928. iconRes = itemCfg.res;
  929. partName = itemCfg.name;
  930. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  931. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  932. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  933. ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  934. listItem.m_ScoreType.visible = true;
  935. // int mainScore;
  936. // int mainValuel;
  937. // ItemDataManager.GetMainScore(id, out mainScore, out mainValuel);
  938. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + _fightCfg.scoreType);
  939. listItem.m_txtScore.text = "" + ItemDataManager.GetItemAdditionScore(id, _fightCfg.scoreType, _fightCfg.needTagsArr);
  940. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  941. listItem.m_txtTitle.text = partName;
  942. listItem.target.data = id;
  943. // listItem.m_txtScore.visible = false;
  944. //listItem.m_ScoreType.visible = true;
  945. listItem.m_imgNeed.visible = false;
  946. listItem.m_btnAni.visible = false;
  947. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  948. listItem.m_imgNew.visible = isNew;
  949. if (isNew)
  950. {
  951. ItemProxy.ReqSetItemRead(id).Coroutine();
  952. }
  953. UI_PartsListItem.ProxyEnd();
  954. }
  955. private void UpdateListPartsSelected()
  956. {
  957. int count = _ui.m_partsList.m_list.numChildren;
  958. int suitId = MyDressUpHelper.dressUpObj.suitId;
  959. for (int i = 0; i < count; i++)
  960. {
  961. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(i));
  962. int id = (int)listItem.target.data;
  963. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  964. {
  965. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  966. }
  967. else
  968. {
  969. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  970. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  971. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  972. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  973. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  974. }
  975. UI_PartsListItem.ProxyEnd();
  976. }
  977. }
  978. private void UpdateSearchListPartsSelected()
  979. {
  980. int count = _ui.m_partsListSearch.m_list.numChildren;
  981. int suitId = MyDressUpHelper.dressUpObj.suitId;
  982. for (int i = 0; i < count; i++)
  983. {
  984. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsListSearch.m_list.GetChildAt(i));
  985. int id = (int)listItem.target.data;
  986. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  987. {
  988. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  989. }
  990. else
  991. {
  992. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  993. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  994. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  995. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  996. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  997. }
  998. UI_PartsListItem.ProxyEnd();
  999. }
  1000. }
  1001. private void UpdateListSuitPartsSelected()
  1002. {
  1003. int count = _ui.m_partsList2.m_list.numChildren;
  1004. int suitId = MyDressUpHelper.dressUpObj.suitId;
  1005. for (int i = 0; i < count; i++)
  1006. {
  1007. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  1008. int id = (int)listItem.target.data;
  1009. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//非套装金判断是否穿戴
  1010. var isSceneType = DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(id);
  1011. bool isSuit = !isSceneType && suitId > 0 && SuitCfgArray.Instance.GetSuitIdOfItem(id) == suitId;//非场景类, 若当前穿戴套装要判断item是否属于套装(更换场景类不会改变套装穿戴状态)
  1012. bool isSceneSuit = isSceneType && suitId > 0 && isPutOn;//场景类, 若当前穿戴套装要判断item是否属已穿戴
  1013. listItem.m_iconSelected.visible = isPutOn || isSuit || isSceneSuit;
  1014. UI_PartsListItem.ProxyEnd();
  1015. }
  1016. }
  1017. private void ShowTaskHint()
  1018. {
  1019. _ui.m_btnClose.visible = true;
  1020. _ui.m_grpTips.visible = true;
  1021. _ui.m_txtHint.text = _levelCfg.hint;
  1022. if (this._ui.m_txtHint.textHeight > this._ui.m_txtHint.textFormat.size * 2)
  1023. {
  1024. this._ui.m_txtHint.align = AlignType.Left;
  1025. }
  1026. else
  1027. {
  1028. this._ui.m_txtHint.align = AlignType.Center;
  1029. }
  1030. }
  1031. private void UpdateScore()
  1032. {
  1033. _ui.m_txtScore.text = "" + FightDataManager.Instance.GetScore(InstanceZonesDataManager.roleData).ToString();
  1034. // GuideController.TryGuideDressUpFightViewBtnNext(_ui.m_btnNext);
  1035. }
  1036. private void OnClickBtnSearch()
  1037. {
  1038. ViewManager.Show<DressFilterView>(false, new object[] { ViewName.DRESS_UP_VIEW });
  1039. }
  1040. private void OnClickBtnAutoPlay()
  1041. {
  1042. FightDataManager.Instance.autoPlay = _ui.m_btnAutoPlay.selected;
  1043. }
  1044. private void OnClickComNeed()
  1045. {
  1046. if (_fightCfg.needItemId <= 0 && _fightCfg.needSuitId <= 0)
  1047. {
  1048. return;
  1049. }
  1050. if (_fightCfg.needSuitId > 0)
  1051. {
  1052. ViewManager.Show<SuitPartsDetailView>(_fightCfg.needSuitId, new object[] { typeof(DressUpFightView).FullName, this.viewData });
  1053. }
  1054. else
  1055. {
  1056. int itemId = (int)_ui.m_compNeed.target.data;
  1057. object[] sourceDatas = new object[] { itemId, new object[] { ViewName.DRESS_UP_FIGHT_VIEW, this.viewData }, 1 };
  1058. GoodsItemTipsController.ShowItemTips(itemId, sourceDatas);
  1059. }
  1060. }
  1061. private void RenderListTagItem(int index, GObject obj)
  1062. {
  1063. UI.CommonGame.UI_ComTag item = UI.CommonGame.UI_ComTag.Proxy(obj);
  1064. string tag = _fightCfg.needTagsArr[index];
  1065. int tagType = TagCfgArray.Instance.GetCfg(tag).type;
  1066. item.m_txtTag.text = tag;
  1067. item.m_loaTag.url = ResPathUtil.GetCommonGameResPath("fzd_bqbq_" + tagType);
  1068. UI.CommonGame.UI_ComTag.ProxyEnd();
  1069. }
  1070. private bool CheckListCount(int type)
  1071. {
  1072. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  1073. {
  1074. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  1075. }
  1076. else
  1077. {
  1078. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  1079. }
  1080. }
  1081. private void SendLog()
  1082. {
  1083. var levelCfg = StoryLevelCfgArray.Instance.GetCfg(_levelID);
  1084. switch (levelCfg.type)
  1085. {
  1086. case ConstInstanceZonesType.Story:
  1087. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.CHUN_ZHONG_LOU, 2);
  1088. break;
  1089. case ConstInstanceZonesType.Studio:
  1090. StudioCfg studioCfg = StudioCfgArray.Instance.GetCfg(levelCfg.chapterId);
  1091. if (studioCfg.funId == typeof(StudioMetalView).Name)
  1092. {
  1093. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.JIN_SHU_XIU_FU, 2);
  1094. }
  1095. else if (studioCfg.funId == typeof(StudioFabricView).Name)
  1096. {
  1097. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.ZHI_WU_XIU_FU, 2);
  1098. }
  1099. else if (studioCfg.funId == typeof(StudioPropertyView).Name)
  1100. {
  1101. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHU_HUA_XIU_FU, 2);
  1102. }
  1103. break;
  1104. }
  1105. }
  1106. private void CheckGuide(object param)
  1107. {
  1108. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0
  1109. || GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0
  1110. || GuideDataManager.IsGuideFinish(ConstGuideId.AUTOPLAY_FIGHT) <= 0)
  1111. {
  1112. UpdateToCheckGuide(null);
  1113. }
  1114. else
  1115. {
  1116. Timers.inst.Remove(CheckGuide);
  1117. }
  1118. _ui.m_loaGuide.visible = false;
  1119. }
  1120. protected override void UpdateToCheckGuide(object param)
  1121. {
  1122. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  1123. int buyClothingIndex = 0;
  1124. int buyClothingSubIndex = 0;
  1125. int taozhuangIndex = 0;
  1126. int len = _ui.m_comListType1.m_listType.numChildren;
  1127. for (int i = 0; i < len; i++)
  1128. {
  1129. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  1130. if (item != null)
  1131. {
  1132. int menuID = (int)item.target.data;
  1133. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  1134. if (GuideDataManager.IsGuideFinish(ConstGuideId.START_FIGHT) <= 0 && dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  1135. {
  1136. taozhuangIndex = i;
  1137. break;
  1138. }
  1139. if (GuideDataManager.IsGuideFinish(ConstGuideId.BUY_CLOTHING) <= 0 && _fightCfg.needItemId > 0 && ItemUtil.CheckMenuType1(_fightCfg.needItemId, _fightCfg.needSuitId, dressUpMenuItemCfg1.id))
  1140. {
  1141. buyClothingIndex = i;
  1142. break;
  1143. }
  1144. }
  1145. UI_TypeItem.ProxyEnd();
  1146. }
  1147. buyClothingSubIndex = _currentList3.IndexOf(_fightCfg.needItemId);
  1148. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.START_FIGHT, 3, "点击相应的分类,可以快速找到服饰。", taozhuangIndex);
  1149. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.START_FIGHT, 4, "", 0);
  1150. GuideController.TryGuide(_ui.m_btnNext, ConstGuideId.START_FIGHT, 5, "穿着完毕,来验证一下,换上的服饰是否符合需求。");
  1151. // GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
  1152. GuideController.TryGuide(_ui.m_compNeed.target, ConstGuideId.BUY_CLOTHING, 3, "当提示有“必需品”时,需要穿上对应物品才能通关。");
  1153. GuideController.TryGuide(_ui.m_comListType1.m_listType, ConstGuideId.BUY_CLOTHING, 7, "按照指示就可以找到必需品啦,点击换上吧。", buyClothingIndex);
  1154. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.BUY_CLOTHING, 8, "", buyClothingSubIndex);
  1155. GuideController.TryCompleteGuide(ConstGuideId.BUY_CLOTHING, 8);
  1156. GuideController.TryGuide(_ui.m_btnHint, ConstGuideId.FIGHT_TIPS, 1, "这次换装需要获得别人的认可呢。");
  1157. GuideController.TryCompleteGuide(ConstGuideId.FIGHT_TIPS, 1);
  1158. GuideController.TryGuide(_ui.m_btnRecommend, ConstGuideId.AUTOPLAY_FIGHT, 1, "衣服太多难以选择,可以点击这里。");
  1159. GuideController.TryGuide(_ui.m_btnAutoPlay, ConstGuideId.AUTOPLAY_FIGHT, 2, "勾选后,自动进行比拼哦~~");
  1160. GuideController.TryCompleteGuide(ConstGuideId.AUTOPLAY_FIGHT, 2);
  1161. }
  1162. protected override void TryCompleteGuide()
  1163. {
  1164. base.TryCompleteGuide();
  1165. // GuideController.TryCompleteGuide(ConstGuideId.START_FIGHT, 5);
  1166. }
  1167. }
  1168. }