DressUpFightView.cs 62 KB

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