DressUpFightView.cs 55 KB

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