DressUpFightView.cs 58 KB

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