DressUpFightView.cs 57 KB

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