DressUpFightView.cs 59 KB

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