DressUpView.cs 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273
  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. Debug.Log(i);
  857. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(i));
  858. int id = (int)listItem.target.data;
  859. if (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG)
  860. {
  861. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  862. }
  863. else if (_currentMenuType == ConstDressUpItemType.DONG_ZUO)
  864. {
  865. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.IsAction &&
  866. MyDressUpHelper.dressUpObj.actionId == id;
  867. }
  868. else
  869. {
  870. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  871. bool isAction = MyDressUpHelper.dressUpObj.IsAction &&
  872. SuitCfgArray.Instance.CheckActionContainsItem(id,
  873. MyDressUpHelper.dressUpObj.actionId);
  874. listItem.m_iconSelected.visible = isPutOn || isAction;
  875. }
  876. UI_PartsListItem.ProxyEnd();
  877. }
  878. }
  879. private void UpdateListSuitPartsSelected()
  880. {
  881. int count = _ui.m_partsList2.m_list.numChildren;
  882. for (int i = 0; i < count; i++)
  883. {
  884. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  885. int id = (int)listItem.target.data;
  886. bool isSuitSelect = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id); //可换部件是否穿戴
  887. bool isActionSelect = MyDressUpHelper.dressUpObj.actionId == id;
  888. listItem.m_iconSelected.visible = isSuitSelect || isActionSelect;
  889. UI_PartsListItem.ProxyEnd();
  890. }
  891. }
  892. private void UpdatePartsListSort()
  893. {
  894. if (_currentMenuType == 0) return;
  895. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  896. {
  897. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  898. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  899. {
  900. _currentList3 = SuitUtil.SortSuitListByHighRarity(_currentList3);
  901. }
  902. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  903. {
  904. _currentList3 = SuitUtil.SortSuitListByLowRarity(_currentList3);
  905. }
  906. else
  907. {
  908. _currentList3.Reverse();
  909. }
  910. }
  911. else if (_currentMenuType == (int)ConstDressUpItemType.DONG_ZUO)
  912. {
  913. _currentList3 = DressUpMenuSuitDataManager.GetActionIDList();
  914. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  915. {
  916. _currentList3 = SuitUtil.SortSuitListByHighRarity(_currentList3);
  917. }
  918. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  919. {
  920. _currentList3 = SuitUtil.SortSuitListByLowRarity(_currentList3);
  921. }
  922. else
  923. {
  924. _currentList3.Reverse();
  925. }
  926. }
  927. else
  928. {
  929. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  930. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  931. {
  932. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighRarity(_currentList3);
  933. }
  934. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  935. {
  936. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowRarity(_currentList3);
  937. }
  938. else
  939. {
  940. _currentList3.Reverse();
  941. }
  942. }
  943. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  944. // {
  945. // _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
  946. // }
  947. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  948. // {
  949. // _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
  950. // }
  951. _ui.m_partsList.m_list.RemoveChildrenToPool();
  952. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  953. }
  954. private void UpdateSuitPartsListSort()
  955. {
  956. if (_currentMenuType == 0) return;
  957. if (_isNormalSuitType)
  958. {
  959. _currentList4 = new List<int>(SuitCfgArray.Instance.GetSuitItems(_currentSuitId));
  960. }
  961. else
  962. {
  963. _currentList4 = SuitCfgArray.Instance.GetOneSuitAllNotActionParts(_currentSuitId);
  964. _currentList4.Add(_currentSuitId);
  965. }
  966. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  967. // {
  968. // _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4);
  969. // }
  970. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  971. // {
  972. // _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4);
  973. // }
  974. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  975. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  976. }
  977. private void UpdateBtnAction()
  978. {
  979. // _ui.m_btnAction.visible = (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG) || this.currentListType == DressUpListType.List4;
  980. // if (_ui.m_btnAction.visible)
  981. // {
  982. //_ui.m_btnAction.grayed = !EquipDataCache.cacher.HasSuitActionRes;
  983. // }
  984. }
  985. private void OnClickBtnShow()
  986. {
  987. Timers.inst.Remove(SetBtnShowVisable);
  988. _ui.m_c1.selectedIndex = 0;
  989. _ui.m_btnHide.visible = true;
  990. _ui.m_btnShow.visible = false;
  991. _ui.m_loaShow.visible = false;
  992. }
  993. private void OnClickBtnHide()
  994. {
  995. _ui.m_c1.selectedIndex = 1;
  996. _ui.m_btnHide.visible = false;
  997. _ui.m_btnShow.visible = true;
  998. _ui.m_loaShow.visible = true;
  999. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  1000. }
  1001. private void OnClickLoaShow()
  1002. {
  1003. _ui.m_btnShow.alpha = 1;
  1004. _ui.m_btnShow.enabled = true;
  1005. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  1006. }
  1007. private void OnClickBtnPhoto()
  1008. {
  1009. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.PAI_ZHAO, 1);
  1010. if (!ViewManager.Show<PhotographView>())
  1011. {
  1012. return;
  1013. }
  1014. _ui.target.visible = false;
  1015. this._sceneObject.gameObject.SetActive(false);
  1016. }
  1017. private void OnClickBtnNext()
  1018. {
  1019. // if (!EquipDataCache.cacher.CheckPutOnFinish())
  1020. // {
  1021. // AlertUI.Show("只有换好衣服才能出门哦!")
  1022. // .SetRightButton(true, "好的");
  1023. // return;
  1024. // }
  1025. if (!ViewManager.Show<PhotographView>(this.viewData))
  1026. {
  1027. return;
  1028. }
  1029. if (this.viewData != null && (int)this.viewData == 2)
  1030. {
  1031. ViewManager.Show<LoadingView>();
  1032. LoadingView.Instance.SetDesc("正在摆放道具...");
  1033. Timers.inst.StartCoroutine(UpdateLoadProgress());
  1034. }
  1035. _ui.target.visible = false;
  1036. this._sceneObject.gameObject.SetActive(false);
  1037. }
  1038. private IEnumerator UpdateLoadProgress()
  1039. {
  1040. yield return new WaitForEndOfFrame();
  1041. LoadingView.Instance.SetProgress(100, () => { ViewManager.Hide<LoadingView>(); }
  1042. );
  1043. }
  1044. private void UpdateScene()
  1045. {
  1046. _ui.target.visible = true;
  1047. this._sceneObject.gameObject.SetActive(true);
  1048. }
  1049. private void SetBtnShowVisable(object param)
  1050. {
  1051. _ui.m_btnShow.enabled = false;
  1052. GTween.To(1, 0, 0.3f).SetTarget(_ui.m_btnShow, TweenPropType.Alpha);
  1053. }
  1054. private bool CheckListCount(int type)
  1055. {
  1056. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  1057. {
  1058. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  1059. }
  1060. else
  1061. {
  1062. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  1063. }
  1064. }
  1065. private void CheckGuide(object param)
  1066. {
  1067. if (GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0
  1068. || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER) <= 0)
  1069. {
  1070. UpdateToCheckGuide(null);
  1071. }
  1072. else
  1073. {
  1074. Timers.inst.Remove(CheckGuide);
  1075. }
  1076. }
  1077. protected override void UpdateToCheckGuide(object param)
  1078. {
  1079. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  1080. if (listTypeItem_FreedomDress == null && GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0)
  1081. {
  1082. int len = _ui.m_comListType1.m_listType.numChildren;
  1083. for (int i = 0; i < len; i++)
  1084. {
  1085. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  1086. if (item != null)
  1087. {
  1088. int menuID = (int)item.target.data;
  1089. DressUpMenuItemCfg1 dressUpMenuItemCfg1 =
  1090. CommonDataManager.Tables.TblDressUpMenuItemCfg1.GetOrDefault(menuID);
  1091. if (dressUpMenuItemCfg1.Type == ConstDressUpItemType.TAO_ZHUANG)
  1092. {
  1093. listTypeItem_FreedomDress = item;
  1094. _ui.m_comListType1.m_listType.ScrollToView(i);
  1095. break;
  1096. }
  1097. }
  1098. UI_TypeItem.ProxyEnd();
  1099. }
  1100. }
  1101. if (listTypeItem_FreedomDress != null)
  1102. GuideController.TryGuide(listTypeItem_FreedomDress.target, ConstGuideId.FREEDOM_DRESS, 3,
  1103. "套装分类里,可以查看集齐成套的服饰,点击一键换上。");
  1104. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.FREEDOM_DRESS, 4, "", 0);
  1105. // if (_ui.m_partsList.m_list.numItems > 0)
  1106. // {
  1107. // UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(0).asCom);
  1108. // GuideController.TryGuide(listItem.m_comAxtionSelect.m_btnAction, ConstGuideId.FREEDOM_DRESS, 5, "选择特殊动作并穿上。");
  1109. // UI_PartsListItem.ProxyEnd();
  1110. // }
  1111. GuideController.TryGuide(_ui.m_btnSave, ConstGuideId.FREEDOM_DRESS, 5, "搭配好的服饰,可以保存到主界面显示。");
  1112. GuideController.TryGuide(_ui.m_btnPhoto, ConstGuideId.FREEDOM_DRESS, 6, "辛苦搭配完,去拍个照片留念呀~~");
  1113. GuideController.TryGuide(_ui.m_btnBack, ConstGuideId.ENTER_CHAPTER, 2, "");
  1114. }
  1115. }
  1116. }