DressUpFightView.cs 63 KB

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