DressUpFightView.cs 54 KB

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