DressUpFightView.cs 53 KB

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