DressUpView.cs 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272
  1. using UI.DressUp;
  2. using FairyGUI;
  3. using UnityEngine;
  4. using System.Collections.Generic;
  5. using ET;
  6. using System;
  7. using System.Collections;
  8. using cfg.GfgCfg;
  9. namespace GFGGame
  10. {
  11. public class DressUpView : BaseView
  12. {
  13. public const int MAX_MEMORY_STEP = 20; //最大记录步数
  14. public const int BOTTOM_BLANK = 20;
  15. public const int RIGHT_BLANK = 36;
  16. private const int SORT_BY_HIGH_RARITY = 0;
  17. private const int SORT_BY_LOW_RARITY = 1;
  18. private const int SORT_BY_GET_TIME = 2;
  19. private UI_DressUpUI _ui;
  20. private float listType1X = 0;
  21. private float partsListX = 0;
  22. private float partsListScrollingPosY = 0;
  23. private DressUpListType currentListType;
  24. /// <summary>
  25. /// 子菜单列表
  26. /// </summary>
  27. private List<int> _currentList2;
  28. private GameObject _sceneObject;
  29. private List<int> _currentList3 = new List<int>();
  30. private List<int> _currentList4 = new List<int>();
  31. private int _currentMenuType;
  32. private int _currentSuitId;
  33. private bool _isNormalSuitType = false; //当前套装部件列表是否为普通动作列表
  34. private int _rarityIndex = SORT_BY_HIGH_RARITY;
  35. private UI_TypeItem listTypeItem_FreedomDress;
  36. private List<LongPressGesture> _listLongPress = new List<LongPressGesture>();
  37. private int currentIndex = 0;
  38. //用于记录任意列表是否滚动,来阻断长按事件
  39. private bool listScrolled = false;
  40. //用来阻断长按后的点击事件
  41. private bool longPressed = false;
  42. public override void Dispose()
  43. {
  44. if (_sceneObject != null)
  45. {
  46. PrefabManager.Instance.Restore(_sceneObject);
  47. _sceneObject = null;
  48. }
  49. for (int i = 0; i < _listLongPress.Count; i++)
  50. {
  51. _listLongPress[i].Dispose();
  52. }
  53. _listLongPress.Clear();
  54. if (_ui != null)
  55. {
  56. _ui.Dispose();
  57. _ui = null;
  58. }
  59. base.Dispose();
  60. }
  61. protected override void Init()
  62. {
  63. base.Init();
  64. packageName = UI_DressUpUI.PACKAGE_NAME;
  65. _ui = UI_DressUpUI.Create();
  66. viewCom = _ui.target;
  67. isfullScreen = true;
  68. isReturnView = true;
  69. }
  70. protected override void OnInit()
  71. {
  72. base.OnInit();
  73. _ui.m_btnLastStep.visible = true;
  74. _ui.m_btnNextStep.visible = true;
  75. _ui.m_btnSearch.visible = true;
  76. _ui.m_btnPhoto.visible = true;
  77. _ui.m_btnAction.visible = false;
  78. // _ui.m_comboBox.items = new string[] { "我的套装一", "我的套装二", "我的套装三", "我的套装四", "我的套装五", "我的套装六" };
  79. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  80. _ui.m_partsListSearch.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  81. InitLists();
  82. _ui.m_btnBack.onClick.Add(OnClickBtnBack);
  83. _ui.m_btnHome.onClick.Add(OnClickBtnHome);
  84. _ui.m_btnLastStep.onClick.Add(OnClickBtnLastStep);
  85. _ui.m_btnNextStep.onClick.Add(OnClickBtnNextStep);
  86. _ui.m_comboBox.onChanged.Add(OnComboBoxChanged);
  87. _ui.m_comListType1.m_listType.onClickItem.Add(OnClickListType1Item);
  88. _ui.m_comListType2.m_listType.onClickItem.Add(OnClickListType2Item);
  89. // _ui.m_partsList.m_list.SetVirtual();
  90. // _ui.m_partsList.m_list.onClickItem.Add(OnClickPartsListItem);
  91. _ui.m_partsList2.m_list.onClickItem.Add(OnClickSuitPartsListItem);
  92. // _ui.m_partsListSearch.m_list.onClickItem.Add(OnClickPartsListItem);
  93. _ui.m_touchPad.onClick.Add(OnTouchPad);
  94. _ui.m_btnDelete.onClick.Add(OnClickBtnDelete);
  95. _ui.m_btnSave.onClick.Add(OnClickBtnSave);
  96. _ui.m_partsList.m_comboBoxRarity.onChanged.Add(OnComboBoxRarityChanged);
  97. _ui.m_partsListSearch.m_comboBoxRarity.onChanged.Add(OnSearchComboBoxRarityChanged);
  98. _ui.m_btnAction.onClick.Add(OnClickBtnAction);
  99. _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
  100. _ui.m_btnNext.onClick.Add(OnClickBtnNext);
  101. _ui.m_btnShow.onClick.Add(OnClickBtnShow);
  102. _ui.m_btnHide.onClick.Add(OnClickBtnHide);
  103. _ui.m_loaShow.onClick.Add(OnClickLoaShow);
  104. _ui.m_btnPhoto.onClick.Add(OnClickBtnPhoto);
  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. _ui.m_partsList.m_list.scrollPane.onScroll.Add(OnListScroll);
  109. GRoot.inst.onTouchBegin.Add(onTouchBegin);
  110. }
  111. private void onTouchBegin(EventContext context)
  112. {
  113. //LogUtil.LogEditor("onTouchBegin");
  114. listScrolled = false;
  115. longPressed = false;
  116. }
  117. private void OnListScroll(EventContext context)
  118. {
  119. //LogUtil.LogEditor("OnListScroll");
  120. listScrolled = true;
  121. }
  122. private void InitLists()
  123. {
  124. _ui.m_comListType2.m_listType.itemRenderer = ListType2Item;
  125. _ui.m_partsList.m_list.itemRenderer = ListPartsItem;
  126. _ui.m_partsList2.m_list.itemRenderer = ListParts2Item;
  127. _ui.m_partsListSearch.m_list.itemRenderer = ListPartsItem;
  128. listType1X = _ui.m_comListType1.target.x;
  129. partsListX = _ui.m_partsList.target.x - _ui.m_partsList.target.width; // - DressUpView.RIGHT_BLANK;
  130. //一级菜单
  131. _ui.m_comListType1.m_listType.itemRenderer = ListType1Item;
  132. _ui.m_comListType1.m_listType.numItems = CommonDataManager.Tables.TblDressUpMenuItemCfg1.DataList.Count;
  133. //_ui.m_comListType1.m_listType1.ResizeToFit(_ui.m_comListType1.m_listType1.numItems);
  134. float maxHeight = _ui.target.height - _ui.m_comListType1.target.y - DressUpView.BOTTOM_BLANK;
  135. if (_ui.m_comListType1.m_listType.height > maxHeight)
  136. {
  137. _ui.m_comListType1.m_listType.height = maxHeight;
  138. }
  139. }
  140. protected override void AddEventListener()
  141. {
  142. base.AddEventListener();
  143. EventAgent.AddEventListener(ConstMessage.CLOSE_PHOTOGRAPHVIEW, UpdateScene);
  144. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
  145. EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, UpdateSearch);
  146. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, UpdateSearch);
  147. EventAgent.AddEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
  148. }
  149. protected override void OnShown()
  150. {
  151. base.OnShown();
  152. if (this.viewData != null)
  153. {
  154. _ui.m_c2.selectedIndex = (int)this.viewData;
  155. }
  156. _rarityIndex = SORT_BY_HIGH_RARITY;
  157. // MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DRESS_UP, "mp3"));
  158. _ui.m_comListType1.target.x = _ui.target.width;
  159. _ui.m_comListType2.target.x = _ui.target.width;
  160. _ui.m_partsList.target.x = _ui.target.width;
  161. _ui.m_partsList2.target.x = _ui.target.width;
  162. _ui.m_partsListSearch.target.x = _ui.target.width;
  163. this.showListType1();
  164. currentIndex = CustomSuitDataManager.currentIndex;
  165. _ui.m_comboBox.items = CustomSuitDataManager.GetSuitPosItems();
  166. _ui.m_comboBox.selectedIndex = currentIndex;
  167. void SetupAfterInstantiate()
  168. {
  169. MyDressUpHelper.dressUpObj.setSceneObj(_sceneObject, false, true, null, true,
  170. ScaleGestureController.Instance.UpdatePos);
  171. if (this.viewData != null && (int)this.viewData == 2)
  172. {
  173. MyDressUpHelper.dressUpObj.PutOnDressUpData(
  174. MatchingCompetitionDataManager.Instance.MathingDressDate);
  175. }
  176. else
  177. {
  178. MyDressUpHelper.PutOnSuitSavedByPos(currentIndex);
  179. }
  180. UpdateStepBtn(true);
  181. Timers.inst.AddUpdate(CheckGuide);
  182. ScaleGestureController.Instance.target = _sceneObject.transform;
  183. ScaleGestureController.Instance.uiSize = _ui.target.size;
  184. }
  185. if (_sceneObject == null)
  186. {
  187. PrefabManager.Instance.InstantiateAsync(
  188. ResPathUtil.GetPrefabPath("SceneDressUp"),
  189. (go) =>
  190. {
  191. if (go != null)
  192. {
  193. _sceneObject = go;
  194. SetupAfterInstantiate();
  195. }
  196. else
  197. {
  198. Debug.LogError("场景对象异步加载失败: SceneDressUp");
  199. }
  200. });
  201. }
  202. else
  203. {
  204. SetupAfterInstantiate();
  205. }
  206. }
  207. protected override void OnHide()
  208. {
  209. base.OnHide();
  210. listTypeItem_FreedomDress = null;
  211. // MusicManager.Instance.Play(ResPathUtil.GetMusicPath(ConstMusicName.DEFAULT));
  212. MyDressUpHelper.dressUpObj.TakeOffAll();
  213. DressUpMenuItemDataManager.Clear();
  214. if (_sceneObject != null)
  215. {
  216. PrefabManager.Instance.Restore(_sceneObject);
  217. _sceneObject = null;
  218. //MyDressUpHelper.dressUpObj.ClearView();
  219. }
  220. _ui.m_c2.selectedIndex = 0;
  221. Reset();
  222. Timers.inst.Remove(CheckGuide);
  223. ScaleGestureController.Instance.target = null;
  224. // 清空服装过滤界面选择
  225. EventAgent.DispatchEvent(ConstMessage.DRESS_FILTER_RESET_ALL);
  226. }
  227. protected override void RemoveEventListener()
  228. {
  229. base.RemoveEventListener();
  230. EventAgent.RemoveEventListener(ConstMessage.CLOSE_PHOTOGRAPHVIEW, UpdateScene);
  231. EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, UpdatePartsListSort);
  232. EventAgent.RemoveEventListener(ConstMessage.DRESS_SEARCH, UpdateSearch);
  233. EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, UpdateSearch);
  234. EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER_RESET, DressResetSerch);
  235. }
  236. private void OnClickBtnBack()
  237. {
  238. Reset();
  239. // this.Hide();
  240. //ViewManager.Show<MainUIView>();
  241. ViewManager.GoBackFrom(typeof(DressUpView).FullName);
  242. }
  243. private void OnClickBtnHome()
  244. {
  245. GameController.GoBackToMainView();
  246. Reset();
  247. }
  248. private void Reset()
  249. {
  250. DressUpMenuItemDataManager.Clear();
  251. MyDressUpHelper.ResetMemory();
  252. }
  253. private void OnClickBtnLastStep()
  254. {
  255. if (!MyDressUpHelper.OnClickBtnLastStep()) return;
  256. UpdateStepBtn(false);
  257. }
  258. private void OnClickBtnNextStep()
  259. {
  260. if (!MyDressUpHelper.OnClickBtnNextStep()) return;
  261. UpdateStepBtn(false);
  262. }
  263. private void OnComboBoxChanged()
  264. {
  265. if (_ui.m_comboBox.selectedIndex == currentIndex) return;
  266. if (CustomSuitDataManager.GetPosType(_ui.m_comboBox.selectedIndex) == MonthCardType.Gold &&
  267. !RoleDataManager.CheckIsMonthCardOpenByType(MonthCardType.Gold))
  268. {
  269. ViewManager.Show<StoreView>(new object[]
  270. { ConstStoreTabId.STORE_MONTH_CARD, ConstStoreSubId.STORE_MONTH_GOLD_CARD });
  271. _ui.m_comboBox.selectedIndex = currentIndex;
  272. return;
  273. }
  274. if (CustomSuitDataManager.GetPosType(_ui.m_comboBox.selectedIndex) == MonthCardType.BlackGold &&
  275. !RoleDataManager.CheckIsMonthCardOpenByType(MonthCardType.BlackGold))
  276. {
  277. ViewManager.Show<StoreView>(new object[]
  278. { ConstStoreTabId.STORE_MONTH_CARD, ConstStoreSubId.STORE_MONTH_BLACK_CARD });
  279. _ui.m_comboBox.selectedIndex = currentIndex;
  280. return;
  281. }
  282. currentIndex = _ui.m_comboBox.selectedIndex;
  283. MyDressUpHelper.PutOnSuitSavedByPos(_ui.m_comboBox.selectedIndex);
  284. UpdateStepBtn(true);
  285. }
  286. private void OnClickListType1Item(EventContext context)
  287. {
  288. GObject typeItem = (GObject)context.data as GObject;
  289. int order = (int)typeItem.data;
  290. DressUpMenuItemCfg1 item1 = CommonDataManager.Tables.TblDressUpMenuItemCfg1.DataList[order - 1];
  291. if (item1.SubMenus.Count > 0)
  292. {
  293. this.showListType2(item1.SubMenus);
  294. }
  295. else
  296. {
  297. if (this.showListParts(item1.Type) == false)
  298. {
  299. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  300. return;
  301. }
  302. }
  303. this.hideListType1();
  304. UpdateListPartsSelected();
  305. }
  306. private void OnClickListType2Item(EventContext context)
  307. {
  308. GObject typeItem = (GObject)context.data as GObject;
  309. int order = (int)typeItem.data;
  310. DressUpMenuItemCfg2 item2 = CommonDataManager.Tables.TblDressUpMenuItemCfg2.DataList[order - 1];
  311. if (this.showListParts(item2.Type) == false)
  312. {
  313. PromptController.Instance.ShowFloatTextPrompt("未获得此类部件");
  314. return;
  315. }
  316. this.hideListType2();
  317. }
  318. private void OnClickPartsListItem(EventContext context)
  319. {
  320. //LogUtil.LogEditor("OnClickPartsListItem");
  321. if (longPressed) return;
  322. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  323. {
  324. return;
  325. }
  326. int id = (int)(context.sender as GObject).data;
  327. if (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG)
  328. {
  329. partsListScrollingPosY = _ui.m_partsList.m_list.scrollPane.scrollingPosY;
  330. MatchingCompetitionDataManager.Instance.DressPropTransInfoDic.Clear();
  331. OnBtnNormalClick(context);
  332. }
  333. else if (_currentMenuType == ConstDressUpItemType.DONG_ZUO)
  334. {
  335. MatchingCompetitionDataManager.Instance.DressPropTransInfoDic.Clear();
  336. MyDressUpHelper.dressUpObj.PutOnOrTakeOffAction(id);
  337. }
  338. else
  339. {
  340. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  341. }
  342. UpdateStepBtn(true, id);
  343. }
  344. private void OnBtnNormalClick(EventContext context)
  345. {
  346. // _isNormalSuitType = true;
  347. GObject gObject = context.sender as GObject;
  348. int suitId = (int)gObject.data;
  349. ShowSuitPartList(suitId, false);
  350. }
  351. private void OnBtnActionClick(EventContext context)
  352. {
  353. if (longPressed) return;
  354. // _isNormalSuitType = false;
  355. GObject gObject = context.sender as GObject;
  356. int suitId = (int)gObject.data;
  357. partsListScrollingPosY = _ui.m_partsList.m_list.scrollPane.scrollingPosY;
  358. ShowSuitPartList(suitId, true);
  359. }
  360. private void ShowSuitPartList(int suitId, bool showAction)
  361. {
  362. _isNormalSuitType = !showAction;
  363. this.showListParts2(suitId);
  364. this.hideListParts();
  365. if (showAction)
  366. {
  367. MyDressUpHelper.dressUpObj.PutOnSuitCfg(suitId, true);
  368. }
  369. else
  370. {
  371. MyDressUpHelper.dressUpObj.PutOnSuitCfg(suitId, false);
  372. }
  373. UpdateStepBtn(true);
  374. }
  375. private void OnClickSuitPartsListItem(EventContext context)
  376. {
  377. if (longPressed) return;
  378. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  379. {
  380. return;
  381. }
  382. GObject listItem = (GObject)context.data as GObject;
  383. int id = (int)listItem.data;
  384. ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(id);
  385. if (itemCfg != null)
  386. {
  387. if (!DressUpMenuItemDataManager.CheckHasItem(itemCfg.Id))
  388. {
  389. PromptController.Instance.ShowFloatTextPrompt("还未获得这件装扮");
  390. return;
  391. }
  392. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  393. }
  394. else
  395. {
  396. MyDressUpHelper.dressUpObj.PutOnOrTakeOffAction(id);
  397. }
  398. UpdateStepBtn(true);
  399. // UpdateListSuitPartsSelected();
  400. }
  401. private void UpdateStepBtn(bool isAdd, int suitId = 0)
  402. {
  403. if (isAdd)
  404. {
  405. MyDressUpHelper.AddMemoryDressup();
  406. }
  407. _ui.m_btnLastStep.enabled = MyDressUpHelper.stepIndex > 0;
  408. _ui.m_btnNextStep.enabled = MyDressUpHelper.stepIndex < MyDressUpHelper.dressMemory.Count - 1;
  409. UpdateListPartsSelected(suitId);
  410. UpdateListSuitPartsSelected();
  411. }
  412. private void OnLongPress(EventContext context)
  413. {
  414. //LogUtil.LogEditor($"OnLongPress {listScrolled}");
  415. if (listScrolled) return;
  416. longPressed = true;
  417. LongPressGesture gesture = (LongPressGesture)context.sender;
  418. int itemId = (int)gesture.host.data;
  419. GoodsItemTipsController.ShowItemTips(itemId);
  420. }
  421. private void OnTouchPad()
  422. {
  423. if (this.currentListType == DressUpListType.List4)
  424. {
  425. this.hideListParts2();
  426. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  427. }
  428. else if (this.currentListType == DressUpListType.List3)
  429. {
  430. if (_currentList2 != null)
  431. {
  432. this.showListType2(_currentList2);
  433. // _ui.m_comListType2.m_listType.numItems = _ui.m_comListType2.m_listType.numItems;
  434. }
  435. else
  436. {
  437. this.showListType1();
  438. }
  439. this.hideListParts();
  440. }
  441. else if (this.currentListType == DressUpListType.List2)
  442. {
  443. this.showListType1();
  444. this.hideListType2();
  445. }
  446. else if (this.currentListType == DressUpListType.List4)
  447. {
  448. this.showListType1();
  449. this.hideListType2();
  450. }
  451. else if (this.currentListType == DressUpListType.List5)
  452. {
  453. this.showListType1();
  454. this.hideSearchListType();
  455. }
  456. // _ui.m_comListType1.m_listType.numItems = _ui.m_comListType1.m_listType.numItems;
  457. // this.ShowSubList();
  458. }
  459. private void OnClickBtnDelete()
  460. {
  461. MyDressUpHelper.dressUpObj.TakeOffAll();
  462. MyDressUpHelper.dressUpObj.AddOrRemove(ConstItemID.DEFULT_BG, false);
  463. MatchingCompetitionDataManager.Instance.DressPropTransInfoDic.Clear();
  464. UpdateBtnAction();
  465. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  466. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  467. UpdateStepBtn(true);
  468. }
  469. private void OnClickBtnSave()
  470. {
  471. CustomSuitDataManager.SaveCurrentSuit(_ui.m_comboBox.selectedIndex);
  472. RoleDataManager.CheckSaveDressUpBgToMainBg(MyDressUpHelper.dressUpObj.bgId);
  473. }
  474. private void OnComboBoxRarityChanged()
  475. {
  476. _rarityIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  477. this.UpdatePartsListSort();
  478. }
  479. private void OnSearchComboBoxRarityChanged()
  480. {
  481. _rarityIndex = _ui.m_partsListSearch.m_comboBoxRarity.selectedIndex;
  482. this.UpdateSearchList();
  483. }
  484. private void OnClickBtnAction()
  485. {
  486. MyDressUpHelper.dressUpObj.PutOnOrTakeOffAction(201003);
  487. }
  488. private void OnClickBtnSearch()
  489. {
  490. ViewManager.Show<DressFilterView>(true);
  491. }
  492. private void showListType1()
  493. {
  494. _currentList2 = null;
  495. currentListType = DressUpListType.List1;
  496. if (this.viewData == null || (int)this.viewData != 2)
  497. {
  498. _ui.m_comListType1.m_listType.numItems = CommonDataManager.Tables.TblDressUpMenuItemCfg1.DataList.Count;
  499. }
  500. else
  501. {
  502. _ui.m_comListType1.m_listType.numItems =
  503. CommonDataManager.Tables.TblDressUpMenuItemCfg1.DataList.Count - 2;
  504. }
  505. GTween.To(_ui.target.width, listType1X, 0.5f)
  506. .SetTarget(_ui.m_comListType1.target)
  507. .OnUpdate((GTweener t) => { _ui.m_comListType1.target.x = t.value.x; });
  508. }
  509. private void hideListType1()
  510. {
  511. GTween.To(listType1X, _ui.target.width, 0.5f)
  512. .SetTarget(_ui.m_comListType1.target)
  513. .OnUpdate((GTweener t) => { _ui.m_comListType1.target.x = t.value.x; });
  514. }
  515. private void showListType2(List<int> menuStrArr = null)
  516. {
  517. currentListType = DressUpListType.List2;
  518. if (menuStrArr != null && menuStrArr.Count > 0)
  519. {
  520. int len = menuStrArr.Count;
  521. _currentList2 = menuStrArr;
  522. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  523. _ui.m_comListType2.m_listType.numItems = len;
  524. //_ui.m_comListType2.m_listType2.ResizeToFit(_ui.m_comListType2.m_listType2.numItems);
  525. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  526. if (_ui.m_comListType2.m_listType.height > maxHeight)
  527. {
  528. _ui.m_comListType2.m_listType.height = maxHeight;
  529. }
  530. }
  531. GTween.To(_ui.target.width, listType1X, 0.5f)
  532. .SetTarget(_ui.m_comListType2.target)
  533. .OnUpdate((GTweener t) => { _ui.m_comListType2.target.x = t.value.x; });
  534. }
  535. private void hideListType2()
  536. {
  537. GTween.To(listType1X, _ui.target.width, 0.5f)
  538. .SetTarget(_ui.m_comListType2.target)
  539. .OnUpdate((GTweener t) => { _ui.m_comListType2.target.x = t.value.x; });
  540. }
  541. private bool showListParts(int type, bool selectItem = false)
  542. {
  543. _currentMenuType = type;
  544. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  545. {
  546. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  547. if (_rarityIndex >= SORT_BY_GET_TIME)
  548. {
  549. _rarityIndex = SORT_BY_HIGH_RARITY;
  550. }
  551. }
  552. else
  553. {
  554. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  555. }
  556. this.UpdatePartsListSort();
  557. if (_ui.m_partsList.m_list.numItems <= 0) return false;
  558. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  559. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y; // - DressUpView.BOTTOM_BLANK;
  560. if (_ui.m_partsList.m_list.height > maxHeight)
  561. {
  562. _ui.m_partsList.m_list.height = maxHeight;
  563. }
  564. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  565. {
  566. _ui.m_partsList.m_list.scrollPane.SetPosY(partsListScrollingPosY, false);
  567. partsListScrollingPosY = 0;
  568. }
  569. currentListType = DressUpListType.List3;
  570. GTween.To(_ui.target.width, partsListX, 0.5f)
  571. .SetTarget(_ui.m_partsList)
  572. .OnUpdate((GTweener t) => { _ui.m_partsList.target.x = t.value.x; });
  573. UpdateBtnAction();
  574. UpdateListPartsSelected();
  575. return true;
  576. }
  577. private void hideListParts()
  578. {
  579. // _currentMenuType = 0;
  580. UpdateBtnAction();
  581. GTween.To(partsListX, _ui.target.width, 0.5f)
  582. .SetTarget(_ui.m_partsList)
  583. .OnUpdate((GTweener t) => { _ui.m_partsList.target.x = t.value.x; });
  584. }
  585. private void showListParts2(int suitId)
  586. {
  587. _currentSuitId = suitId;
  588. _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  589. if (_rarityIndex >= SORT_BY_GET_TIME)
  590. {
  591. _rarityIndex = SORT_BY_HIGH_RARITY;
  592. }
  593. this.UpdateSuitPartsListSort();
  594. _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
  595. float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y; // - DressUpView.BOTTOM_BLANK;
  596. if (_ui.m_partsList2.m_list.height > maxHeight)
  597. {
  598. _ui.m_partsList2.m_list.height = maxHeight;
  599. }
  600. currentListType = DressUpListType.List4;
  601. GTween.To(_ui.target.width, partsListX, 0.5f)
  602. .SetTarget(_ui.m_partsList2)
  603. .OnUpdate((GTweener t) => { _ui.m_partsList2.target.x = t.value.x; });
  604. UpdateBtnAction();
  605. }
  606. private void hideListParts2()
  607. {
  608. _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
  609. UpdateBtnAction();
  610. GTween.To(partsListX, _ui.target.width, 0.5f)
  611. .SetTarget(_ui.m_partsList2)
  612. .OnUpdate((GTweener t) => { _ui.m_partsList2.target.x = t.value.x; });
  613. }
  614. private void showSearchListType()
  615. {
  616. // _currentList2 = null;
  617. currentListType = DressUpListType.List5;
  618. GTween.To(_ui.target.width, partsListX, 0.5f)
  619. .SetTarget(_ui.m_partsListSearch.target)
  620. .OnUpdate((GTweener t) => { _ui.m_partsListSearch.target.x = t.value.x; });
  621. }
  622. private void hideSearchListType()
  623. {
  624. GTween.To(partsListX, _ui.target.width, 0.5f)
  625. .SetTarget(_ui.m_partsListSearch.target)
  626. .OnUpdate((GTweener t) => { _ui.m_partsListSearch.target.x = t.value.x; });
  627. }
  628. /****************************************************************************************************************************/
  629. private void DressResetSerch()
  630. {
  631. if (currentListType == DressUpListType.List5)
  632. {
  633. OnTouchPad();
  634. }
  635. }
  636. private void UpdateSearch(EventContext context)
  637. {
  638. if (context.data.ToString() == ConstMessage.DRESS_SEARCH)
  639. {
  640. _currentList3 = DressUpMenuItemDataManager.DressSearch();
  641. }
  642. else if (context.data.ToString() == ConstMessage.DRESS_FILTER)
  643. {
  644. _currentList3 = DressUpMenuItemDataManager.DressFilter();
  645. }
  646. ViewManager.Hide<ModalStatusView>();
  647. UpdateSearchList();
  648. if (currentListType != DressUpListType.List5)
  649. {
  650. hideListParts();
  651. hideListParts2();
  652. hideListType1();
  653. hideListType2();
  654. showSearchListType();
  655. }
  656. _currentMenuType = 0;
  657. }
  658. private void UpdateSearchList()
  659. {
  660. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  661. {
  662. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighRarity(_currentList3);
  663. }
  664. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  665. {
  666. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowRarity(_currentList3);
  667. }
  668. _currentMenuType = 0;
  669. _ui.m_partsListSearch.m_list.numItems = _currentList3.Count;
  670. }
  671. private void ListType1Item(int index, GObject item)
  672. {
  673. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  674. DressUpMenuItemCfg1 item1 = CommonDataManager.Tables.TblDressUpMenuItemCfg1.DataList[index];
  675. if (this.viewData != null && (int)this.viewData == 2)
  676. {
  677. if (index == CommonDataManager.Tables.TblDressUpMenuItemCfg1.DataList.Count - 2)
  678. {
  679. item1 = CommonDataManager.Tables.TblDressUpMenuItemCfg1.DataList[index + 1];
  680. }
  681. }
  682. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.Id;
  683. typeItem.m_txtname.text = item1.Name;
  684. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  685. typeItem.target.data = item1.Id;
  686. typeItem.m_imgNeed.visible = false;
  687. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.Id);
  688. UI_TypeItem.ProxyEnd();
  689. }
  690. private void ListType2Item(int index, GObject item)
  691. {
  692. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  693. DressUpMenuItemCfg2 item2 =
  694. CommonDataManager.Tables.TblDressUpMenuItemCfg2.DataList[_currentList2[index] - 1];
  695. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.Id;
  696. typeItem.m_txtname.text = item2.Name;
  697. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  698. typeItem.target.data = item2.Id;
  699. typeItem.m_imgNeed.visible = false;
  700. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.Id);
  701. UI_TypeItem.ProxyEnd();
  702. }
  703. private void ListPartsItem(int index, GObject item)
  704. {
  705. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  706. int id = (int)_currentList3[index];
  707. string iconRes = "";
  708. string partName = "";
  709. string ext = "png";
  710. listItem.m_btnAni.visible = false;
  711. Debug.Log("id:" + id + " _currentMenuType:" + _currentMenuType);
  712. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  713. {
  714. SuitCfg suitCfg = CommonDataManager.Tables.TblSuitCfg.GetOrDefault(id);
  715. if (suitCfg == null)
  716. {
  717. return;
  718. }
  719. iconRes = suitCfg.Res;
  720. partName = suitCfg.Name;
  721. listItem.m_iconSelected.visible = false;
  722. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  723. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.Rarity;
  724. listItem.m_ScoreType.visible = false;
  725. listItem.m_imgNew.visible = false;
  726. bool SuitHasAction = SuitCfgArray.Instance.CheckSuitHasAction(id);
  727. bool HasActionRes = DressUpMenuSuitDataManager.CheckSuitHasActionRes(id);
  728. Debug.Log("SuitHasAction:" + SuitHasAction + " HasActionRes:" + HasActionRes + " suitCfg.res" +
  729. suitCfg.AniRes);
  730. listItem.m_btnAni.visible = SuitCfgArray.Instance.CheckSuitHasAction(id) &&
  731. DressUpMenuSuitDataManager.CheckSuitHasActionRes(id);
  732. // listItem.m_comAxtionSelect.m_btnNormal.icon = ResPathUtil.GetIconPath(suitCfg.res, ext);
  733. // listItem.m_comAxtionSelect.m_btnAction.icon = ResPathUtil.GetIconPath(suitCfg.res, ext);
  734. if (listItem.m_btnAni.data == null)
  735. {
  736. listItem.m_btnAni.onClick.Add(OnBtnActionClick);
  737. }
  738. listItem.m_btnAni.data = id;
  739. }
  740. else if (_currentMenuType == (int)ConstDressUpItemType.DONG_ZUO)
  741. {
  742. SuitCfg suitCfg = CommonDataManager.Tables.TblSuitCfg.GetOrDefault(id);
  743. iconRes = suitCfg.Res;
  744. partName = suitCfg.Name;
  745. listItem.m_iconSelected.visible = false;
  746. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  747. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.Rarity;
  748. listItem.m_ScoreType.visible = false;
  749. listItem.m_imgNew.visible = false;
  750. }
  751. else
  752. {
  753. ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(id);
  754. iconRes = itemCfg.Res;
  755. partName = itemCfg.Name;
  756. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  757. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.Rarity;
  758. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  759. // ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  760. listItem.m_ScoreType.visible = true;
  761. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + itemCfg.MainScore);
  762. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  763. listItem.m_imgNew.visible = isNew;
  764. if (isNew)
  765. {
  766. ItemProxy.ReqSetItemRead(id).Coroutine();
  767. }
  768. }
  769. if (listItem.m_icon.data == null)
  770. {
  771. listItem.m_icon.onClick.Add(OnClickPartsListItem);
  772. }
  773. listItem.m_icon.data = id;
  774. if (listItem.target.data == null)
  775. {
  776. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  777. longPressGesture.trigger = GameConfig.LongPressGestureTrigger;
  778. longPressGesture.once = true;
  779. longPressGesture.onAction.Add(OnLongPress);
  780. _listLongPress.Add(longPressGesture);
  781. }
  782. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  783. listItem.m_txtTitle.text = partName;
  784. listItem.target.data = id;
  785. listItem.m_grpScore.visible = false;
  786. //listItem.m_ScoreType.visible = true;
  787. listItem.m_imgNeed.visible = false;
  788. listItem.m_lock.visible = false;
  789. UI_PartsListItem.ProxyEnd();
  790. }
  791. private void ListParts2Item(int index, GObject item)
  792. {
  793. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  794. int id = (int)_currentList4[index];
  795. string iconRes = "";
  796. string partName = "";
  797. // string ext = "png";
  798. if (listItem.target.data == null)
  799. {
  800. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  801. longPressGesture.trigger = GameConfig.LongPressGestureTrigger;
  802. longPressGesture.once = true;
  803. longPressGesture.onAction.Add(OnLongPress);
  804. _listLongPress.Add(longPressGesture);
  805. }
  806. ItemCfg itemCfg = CommonDataManager.Tables.TblItemCfg.GetOrDefault(id);
  807. SuitCfg suitCfg = CommonDataManager.Tables.TblSuitCfg.GetOrDefault(id);
  808. iconRes = itemCfg != null ? itemCfg.Res : suitCfg.Res;
  809. partName = itemCfg != null ? itemCfg.Name : suitCfg.Name;
  810. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  811. bool isAction = MyDressUpHelper.dressUpObj.IsAction &&
  812. SuitCfgArray.Instance.CheckActionContainsItem(id, MyDressUpHelper.dressUpObj.actionId);
  813. listItem.m_iconSelected.visible = isPutOn || isAction;
  814. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, itemCfg == null);
  815. listItem.m_ScoreType.visible = false;
  816. if (itemCfg != null)
  817. {
  818. listItem.m_ScoreType.visible = true;
  819. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + itemCfg.MainScore);
  820. }
  821. listItem.m_btnAni.visible = false;
  822. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, "png");
  823. listItem.m_txtTitle.text = partName;
  824. listItem.target.data = id;
  825. listItem.m_grpScore.visible = false;
  826. //listItem.m_ScoreType.visible = true;
  827. listItem.m_imgNeed.visible = false;
  828. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  829. listItem.m_imgNew.visible = isNew;
  830. listItem.m_lock.visible = false;
  831. if (isNew)
  832. {
  833. ItemProxy.ReqSetItemRead(id).Coroutine();
  834. }
  835. UI_PartsListItem.ProxyEnd();
  836. }
  837. private void UpdateListPartsSelected(int selectSuitId = 0)
  838. {
  839. GList list;
  840. if (_ui.m_partsList.target.x == partsListX)
  841. {
  842. list = _ui.m_partsList.m_list;
  843. }
  844. else if (_ui.m_partsListSearch.target.x == partsListX)
  845. {
  846. list = _ui.m_partsListSearch.m_list;
  847. }
  848. else
  849. {
  850. return;
  851. }
  852. int count = list.numChildren;
  853. int suitId = MyDressUpHelper.dressUpObj.suitId;
  854. for (int i = 0; i < count; i++)
  855. {
  856. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(i));
  857. int id = (int)listItem.target.data;
  858. if (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG)
  859. {
  860. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  861. }
  862. else if (_currentMenuType == ConstDressUpItemType.DONG_ZUO)
  863. {
  864. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.IsAction &&
  865. MyDressUpHelper.dressUpObj.actionId == id;
  866. }
  867. else
  868. {
  869. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  870. bool isAction = MyDressUpHelper.dressUpObj.IsAction &&
  871. SuitCfgArray.Instance.CheckActionContainsItem(id,
  872. MyDressUpHelper.dressUpObj.actionId);
  873. listItem.m_iconSelected.visible = isPutOn || isAction;
  874. }
  875. UI_PartsListItem.ProxyEnd();
  876. }
  877. }
  878. private void UpdateListSuitPartsSelected()
  879. {
  880. int count = _ui.m_partsList2.m_list.numChildren;
  881. for (int i = 0; i < count; i++)
  882. {
  883. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  884. int id = (int)listItem.target.data;
  885. bool isSuitSelect = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id); //可换部件是否穿戴
  886. bool isActionSelect = MyDressUpHelper.dressUpObj.actionId == id;
  887. listItem.m_iconSelected.visible = isSuitSelect || isActionSelect;
  888. UI_PartsListItem.ProxyEnd();
  889. }
  890. }
  891. private void UpdatePartsListSort()
  892. {
  893. if (_currentMenuType == 0) return;
  894. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  895. {
  896. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  897. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  898. {
  899. _currentList3 = SuitUtil.SortSuitListByHighRarity(_currentList3);
  900. }
  901. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  902. {
  903. _currentList3 = SuitUtil.SortSuitListByLowRarity(_currentList3);
  904. }
  905. else
  906. {
  907. _currentList3.Reverse();
  908. }
  909. }
  910. else if (_currentMenuType == (int)ConstDressUpItemType.DONG_ZUO)
  911. {
  912. _currentList3 = DressUpMenuSuitDataManager.GetActionIDList();
  913. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  914. {
  915. _currentList3 = SuitUtil.SortSuitListByHighRarity(_currentList3);
  916. }
  917. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  918. {
  919. _currentList3 = SuitUtil.SortSuitListByLowRarity(_currentList3);
  920. }
  921. else
  922. {
  923. _currentList3.Reverse();
  924. }
  925. }
  926. else
  927. {
  928. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  929. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  930. {
  931. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighRarity(_currentList3);
  932. }
  933. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  934. {
  935. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowRarity(_currentList3);
  936. }
  937. else
  938. {
  939. _currentList3.Reverse();
  940. }
  941. }
  942. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  943. // {
  944. // _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
  945. // }
  946. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  947. // {
  948. // _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
  949. // }
  950. _ui.m_partsList.m_list.RemoveChildrenToPool();
  951. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  952. }
  953. private void UpdateSuitPartsListSort()
  954. {
  955. if (_currentMenuType == 0) return;
  956. if (_isNormalSuitType)
  957. {
  958. _currentList4 = new List<int>(SuitCfgArray.Instance.GetSuitItems(_currentSuitId));
  959. }
  960. else
  961. {
  962. _currentList4 = SuitCfgArray.Instance.GetOneSuitAllNotActionParts(_currentSuitId);
  963. _currentList4.Add(_currentSuitId);
  964. }
  965. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  966. // {
  967. // _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4);
  968. // }
  969. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  970. // {
  971. // _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4);
  972. // }
  973. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  974. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  975. }
  976. private void UpdateBtnAction()
  977. {
  978. // _ui.m_btnAction.visible = (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG) || this.currentListType == DressUpListType.List4;
  979. // if (_ui.m_btnAction.visible)
  980. // {
  981. //_ui.m_btnAction.grayed = !EquipDataCache.cacher.HasSuitActionRes;
  982. // }
  983. }
  984. private void OnClickBtnShow()
  985. {
  986. Timers.inst.Remove(SetBtnShowVisable);
  987. _ui.m_c1.selectedIndex = 0;
  988. _ui.m_btnHide.visible = true;
  989. _ui.m_btnShow.visible = false;
  990. _ui.m_loaShow.visible = false;
  991. }
  992. private void OnClickBtnHide()
  993. {
  994. _ui.m_c1.selectedIndex = 1;
  995. _ui.m_btnHide.visible = false;
  996. _ui.m_btnShow.visible = true;
  997. _ui.m_loaShow.visible = true;
  998. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  999. }
  1000. private void OnClickLoaShow()
  1001. {
  1002. _ui.m_btnShow.alpha = 1;
  1003. _ui.m_btnShow.enabled = true;
  1004. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  1005. }
  1006. private void OnClickBtnPhoto()
  1007. {
  1008. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.PAI_ZHAO, 1);
  1009. if (!ViewManager.Show<PhotographView>())
  1010. {
  1011. return;
  1012. }
  1013. _ui.target.visible = false;
  1014. this._sceneObject.gameObject.SetActive(false);
  1015. }
  1016. private void OnClickBtnNext()
  1017. {
  1018. // if (!EquipDataCache.cacher.CheckPutOnFinish())
  1019. // {
  1020. // AlertUI.Show("只有换好衣服才能出门哦!")
  1021. // .SetRightButton(true, "好的");
  1022. // return;
  1023. // }
  1024. if (!ViewManager.Show<PhotographView>(this.viewData))
  1025. {
  1026. return;
  1027. }
  1028. if (this.viewData != null && (int)this.viewData == 2)
  1029. {
  1030. ViewManager.Show<LoadingView>();
  1031. LoadingView.Instance.SetDesc("正在摆放道具...");
  1032. Timers.inst.StartCoroutine(UpdateLoadProgress());
  1033. }
  1034. _ui.target.visible = false;
  1035. this._sceneObject.gameObject.SetActive(false);
  1036. }
  1037. private IEnumerator UpdateLoadProgress()
  1038. {
  1039. yield return new WaitForEndOfFrame();
  1040. LoadingView.Instance.SetProgress(100, () => { ViewManager.Hide<LoadingView>(); }
  1041. );
  1042. }
  1043. private void UpdateScene()
  1044. {
  1045. _ui.target.visible = true;
  1046. this._sceneObject.gameObject.SetActive(true);
  1047. }
  1048. private void SetBtnShowVisable(object param)
  1049. {
  1050. _ui.m_btnShow.enabled = false;
  1051. GTween.To(1, 0, 0.3f).SetTarget(_ui.m_btnShow, TweenPropType.Alpha);
  1052. }
  1053. private bool CheckListCount(int type)
  1054. {
  1055. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  1056. {
  1057. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  1058. }
  1059. else
  1060. {
  1061. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  1062. }
  1063. }
  1064. private void CheckGuide(object param)
  1065. {
  1066. if (GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0
  1067. || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER) <= 0)
  1068. {
  1069. UpdateToCheckGuide(null);
  1070. }
  1071. else
  1072. {
  1073. Timers.inst.Remove(CheckGuide);
  1074. }
  1075. }
  1076. protected override void UpdateToCheckGuide(object param)
  1077. {
  1078. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  1079. if (listTypeItem_FreedomDress == null && GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0)
  1080. {
  1081. int len = _ui.m_comListType1.m_listType.numChildren;
  1082. for (int i = 0; i < len; i++)
  1083. {
  1084. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  1085. if (item != null)
  1086. {
  1087. int menuID = (int)item.target.data;
  1088. DressUpMenuItemCfg1 dressUpMenuItemCfg1 =
  1089. CommonDataManager.Tables.TblDressUpMenuItemCfg1.GetOrDefault(menuID);
  1090. if (dressUpMenuItemCfg1.Type == ConstDressUpItemType.TAO_ZHUANG)
  1091. {
  1092. listTypeItem_FreedomDress = item;
  1093. _ui.m_comListType1.m_listType.ScrollToView(i);
  1094. break;
  1095. }
  1096. }
  1097. UI_TypeItem.ProxyEnd();
  1098. }
  1099. }
  1100. if (listTypeItem_FreedomDress != null)
  1101. GuideController.TryGuide(listTypeItem_FreedomDress.target, ConstGuideId.FREEDOM_DRESS, 3,
  1102. "套装分类里,可以查看集齐成套的服饰,点击一键换上。");
  1103. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.FREEDOM_DRESS, 4, "", 0);
  1104. // if (_ui.m_partsList.m_list.numItems > 0)
  1105. // {
  1106. // UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(0).asCom);
  1107. // GuideController.TryGuide(listItem.m_comAxtionSelect.m_btnAction, ConstGuideId.FREEDOM_DRESS, 5, "选择特殊动作并穿上。");
  1108. // UI_PartsListItem.ProxyEnd();
  1109. // }
  1110. GuideController.TryGuide(_ui.m_btnSave, ConstGuideId.FREEDOM_DRESS, 5, "搭配好的服饰,可以保存到主界面显示。");
  1111. GuideController.TryGuide(_ui.m_btnPhoto, ConstGuideId.FREEDOM_DRESS, 6, "辛苦搭配完,去拍个照片留念呀~~");
  1112. GuideController.TryGuide(_ui.m_btnBack, ConstGuideId.ENTER_CHAPTER, 2, "");
  1113. }
  1114. }
  1115. }