DressUpView.cs 48 KB

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