DressUpFightView.cs 59 KB

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