DressUpFightView.cs 59 KB

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