DressUpView.cs 47 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208
  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. OnBtnNormalClick(context);
  304. }
  305. else if (_currentMenuType == ConstDressUpItemType.DONG_ZUO)
  306. {
  307. MyDressUpHelper.dressUpObj.PutOnOrTakeOffAction(id);
  308. }
  309. else
  310. {
  311. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  312. }
  313. UpdateStepBtn(true, id);
  314. }
  315. private void OnBtnNormalClick(EventContext context)
  316. {
  317. // _isNormalSuitType = true;
  318. GObject gObject = context.sender as GObject;
  319. int suitId = (int)gObject.data;
  320. ShowSuitPartList(suitId, false);
  321. }
  322. private void OnBtnActionClick(EventContext context)
  323. {
  324. if (longPressed) return;
  325. // _isNormalSuitType = false;
  326. GObject gObject = context.sender as GObject;
  327. int suitId = (int)gObject.data;
  328. partsListScrollingPosY = _ui.m_partsList.m_list.scrollPane.scrollingPosY;
  329. ShowSuitPartList(suitId, true);
  330. }
  331. private void ShowSuitPartList(int suitId, bool showAction)
  332. {
  333. _isNormalSuitType = !showAction;
  334. this.showListParts2(suitId);
  335. this.hideListParts();
  336. if (showAction)
  337. {
  338. MyDressUpHelper.dressUpObj.PutOnSuitCfg(suitId, true);
  339. }
  340. else
  341. {
  342. MyDressUpHelper.dressUpObj.PutOnSuitCfg(suitId, false);
  343. }
  344. UpdateStepBtn(true);
  345. }
  346. private void OnClickSuitPartsListItem(EventContext context)
  347. {
  348. if (longPressed) return;
  349. if (ViewManager.isViewOpen(typeof(DressUpItemTipsView).FullName))
  350. {
  351. return;
  352. }
  353. GObject listItem = (GObject)context.data as GObject;
  354. int id = (int)listItem.data;
  355. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  356. if (itemCfg != null)
  357. {
  358. if (!DressUpMenuItemDataManager.CheckHasItem(itemCfg.id))
  359. {
  360. PromptController.Instance.ShowFloatTextPrompt("还未获得这件装扮");
  361. return;
  362. }
  363. MyDressUpHelper.dressUpObj.AddOrRemove(id, true);
  364. }
  365. else
  366. {
  367. MyDressUpHelper.dressUpObj.PutOnOrTakeOffAction(id);
  368. }
  369. UpdateStepBtn(true);
  370. // UpdateListSuitPartsSelected();
  371. }
  372. private void UpdateStepBtn(bool isAdd, int suitId = 0)
  373. {
  374. if (isAdd)
  375. {
  376. MyDressUpHelper.AddMemoryDressup();
  377. }
  378. _ui.m_btnLastStep.enabled = MyDressUpHelper.stepIndex > 0;
  379. _ui.m_btnNextStep.enabled = MyDressUpHelper.stepIndex < MyDressUpHelper.dressMemory.Count - 1;
  380. UpdateListPartsSelected(suitId);
  381. UpdateListSuitPartsSelected();
  382. }
  383. private void OnLongPress(EventContext context)
  384. {
  385. //LogUtil.LogEditor($"OnLongPress {listScrolled}");
  386. if (listScrolled) return;
  387. longPressed = true;
  388. LongPressGesture gesture = (LongPressGesture)context.sender;
  389. int itemId = (int)gesture.host.data;
  390. GoodsItemTipsController.ShowItemTips(itemId);
  391. }
  392. private void OnTouchPad()
  393. {
  394. if (this.currentListType == DressUpListType.List4)
  395. {
  396. this.hideListParts2();
  397. this.showListParts(ConstDressUpItemType.TAO_ZHUANG, true);
  398. }
  399. else if (this.currentListType == DressUpListType.List3)
  400. {
  401. if (_currentList2 != null)
  402. {
  403. this.showListType2(_currentList2);
  404. // _ui.m_comListType2.m_listType.numItems = _ui.m_comListType2.m_listType.numItems;
  405. }
  406. else
  407. {
  408. this.showListType1();
  409. }
  410. this.hideListParts();
  411. }
  412. else if (this.currentListType == DressUpListType.List2)
  413. {
  414. this.showListType1();
  415. this.hideListType2();
  416. }
  417. else if (this.currentListType == DressUpListType.List4)
  418. {
  419. this.showListType1();
  420. this.hideListType2();
  421. }
  422. else if (this.currentListType == DressUpListType.List5)
  423. {
  424. this.showListType1();
  425. this.hideSearchListType();
  426. }
  427. // _ui.m_comListType1.m_listType.numItems = _ui.m_comListType1.m_listType.numItems;
  428. // this.ShowSubList();
  429. }
  430. private void OnClickBtnDelete()
  431. {
  432. MyDressUpHelper.dressUpObj.TakeOffAll();
  433. MyDressUpHelper.dressUpObj.AddOrRemove(ConstItemID.DEFULT_BG, false);
  434. UpdateBtnAction();
  435. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  436. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  437. UpdateStepBtn(true);
  438. }
  439. private void OnClickBtnSave()
  440. {
  441. CustomSuitDataManager.SaveCurrentSuit(_ui.m_comboBox.selectedIndex);
  442. RoleDataManager.CheckSaveDressUpBgToMainBg(MyDressUpHelper.dressUpObj.bgId);
  443. }
  444. private void OnComboBoxRarityChanged()
  445. {
  446. _rarityIndex = _ui.m_partsList.m_comboBoxRarity.selectedIndex;
  447. this.UpdatePartsListSort();
  448. }
  449. private void OnSearchComboBoxRarityChanged()
  450. {
  451. _rarityIndex = _ui.m_partsListSearch.m_comboBoxRarity.selectedIndex;
  452. this.UpdateSearchList();
  453. }
  454. private void OnClickBtnAction()
  455. {
  456. MyDressUpHelper.dressUpObj.PutOnOrTakeOffAction(201003);
  457. }
  458. private void OnClickBtnSearch()
  459. {
  460. ViewManager.Show<DressFilterView>(true);
  461. }
  462. private void showListType1()
  463. {
  464. _currentList2 = null;
  465. currentListType = DressUpListType.List1;
  466. if (this.viewData == null || (int)this.viewData != 2)
  467. {
  468. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length;
  469. }
  470. else
  471. {
  472. _ui.m_comListType1.m_listType.numItems = DressUpMenuItemCfg1Array.Instance.dataArray.Length - 3;
  473. }
  474. GTween.To(_ui.target.width, listType1X, 0.5f)
  475. .SetTarget(_ui.m_comListType1.target)
  476. .OnUpdate((GTweener t) =>
  477. {
  478. _ui.m_comListType1.target.x = t.value.x;
  479. });
  480. }
  481. private void hideListType1()
  482. {
  483. GTween.To(listType1X, _ui.target.width, 0.5f)
  484. .SetTarget(_ui.m_comListType1.target)
  485. .OnUpdate((GTweener t) =>
  486. {
  487. _ui.m_comListType1.target.x = t.value.x;
  488. });
  489. }
  490. private void showListType2(int[] menuStrArr = null)
  491. {
  492. currentListType = DressUpListType.List2;
  493. if (menuStrArr != null && menuStrArr.Length > 0)
  494. {
  495. int len = menuStrArr.Length;
  496. _currentList2 = menuStrArr.Clone() as int[];
  497. _ui.m_comListType2.m_listType.RemoveChildrenToPool();
  498. _ui.m_comListType2.m_listType.numItems = len;
  499. //_ui.m_comListType2.m_listType2.ResizeToFit(_ui.m_comListType2.m_listType2.numItems);
  500. float maxHeight = _ui.target.height - _ui.m_comListType2.m_listType.y - DressUpView.BOTTOM_BLANK;
  501. if (_ui.m_comListType2.m_listType.height > maxHeight)
  502. {
  503. _ui.m_comListType2.m_listType.height = maxHeight;
  504. }
  505. }
  506. GTween.To(_ui.target.width, listType1X, 0.5f)
  507. .SetTarget(_ui.m_comListType2.target)
  508. .OnUpdate((GTweener t) =>
  509. {
  510. _ui.m_comListType2.target.x = t.value.x;
  511. });
  512. }
  513. private void hideListType2()
  514. {
  515. GTween.To(listType1X, _ui.target.width, 0.5f)
  516. .SetTarget(_ui.m_comListType2.target)
  517. .OnUpdate((GTweener t) =>
  518. {
  519. _ui.m_comListType2.target.x = t.value.x;
  520. });
  521. }
  522. private bool showListParts(int type, bool selectItem = false)
  523. {
  524. _currentMenuType = type;
  525. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  526. {
  527. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  528. if (_rarityIndex >= SORT_BY_GET_TIME)
  529. {
  530. _rarityIndex = SORT_BY_HIGH_RARITY;
  531. }
  532. }
  533. else
  534. {
  535. _ui.m_partsList.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  536. }
  537. this.UpdatePartsListSort();
  538. if (_ui.m_partsList.m_list.numItems <= 0) return false;
  539. _ui.m_partsList.m_list.ResizeToFit(_ui.m_partsList.m_list.numItems);
  540. float maxHeight = _ui.m_partsList.target.height - _ui.m_partsList.m_list.y;// - DressUpView.BOTTOM_BLANK;
  541. if (_ui.m_partsList.m_list.height > maxHeight)
  542. {
  543. _ui.m_partsList.m_list.height = maxHeight;
  544. }
  545. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  546. {
  547. _ui.m_partsList.m_list.scrollPane.SetPosY(partsListScrollingPosY, false);
  548. partsListScrollingPosY = 0;
  549. }
  550. currentListType = DressUpListType.List3;
  551. GTween.To(_ui.target.width, partsListX, 0.5f)
  552. .SetTarget(_ui.m_partsList)
  553. .OnUpdate((GTweener t) =>
  554. {
  555. _ui.m_partsList.target.x = t.value.x;
  556. });
  557. UpdateBtnAction();
  558. UpdateListPartsSelected();
  559. return true;
  560. }
  561. private void hideListParts()
  562. {
  563. // _currentMenuType = 0;
  564. UpdateBtnAction();
  565. GTween.To(partsListX, _ui.target.width, 0.5f)
  566. .SetTarget(_ui.m_partsList)
  567. .OnUpdate((GTweener t) =>
  568. {
  569. _ui.m_partsList.target.x = t.value.x;
  570. });
  571. }
  572. private void showListParts2(int suitId)
  573. {
  574. _currentSuitId = suitId;
  575. _ui.m_partsList2.m_comboBoxRarity.items = new string[] { "高稀有度", "低稀有度", "最近获得" };
  576. if (_rarityIndex >= SORT_BY_GET_TIME)
  577. {
  578. _rarityIndex = SORT_BY_HIGH_RARITY;
  579. }
  580. this.UpdateSuitPartsListSort();
  581. _ui.m_partsList2.m_list.ResizeToFit(_ui.m_partsList2.m_list.numItems);
  582. float maxHeight = _ui.m_partsList2.target.height - _ui.m_partsList2.m_list.y;// - DressUpView.BOTTOM_BLANK;
  583. if (_ui.m_partsList2.m_list.height > maxHeight)
  584. {
  585. _ui.m_partsList2.m_list.height = maxHeight;
  586. }
  587. currentListType = DressUpListType.List4;
  588. GTween.To(_ui.target.width, partsListX, 0.5f)
  589. .SetTarget(_ui.m_partsList2)
  590. .OnUpdate((GTweener t) =>
  591. {
  592. _ui.m_partsList2.target.x = t.value.x;
  593. });
  594. UpdateBtnAction();
  595. }
  596. private void hideListParts2()
  597. {
  598. _currentMenuType = ConstDressUpItemType.TAO_ZHUANG;
  599. UpdateBtnAction();
  600. GTween.To(partsListX, _ui.target.width, 0.5f)
  601. .SetTarget(_ui.m_partsList2)
  602. .OnUpdate((GTweener t) =>
  603. {
  604. _ui.m_partsList2.target.x = t.value.x;
  605. });
  606. }
  607. private void showSearchListType()
  608. {
  609. // _currentList2 = null;
  610. currentListType = DressUpListType.List5;
  611. GTween.To(_ui.target.width, partsListX, 0.5f)
  612. .SetTarget(_ui.m_partsListSearch.target)
  613. .OnUpdate((GTweener t) =>
  614. {
  615. _ui.m_partsListSearch.target.x = t.value.x;
  616. });
  617. }
  618. private void hideSearchListType()
  619. {
  620. GTween.To(partsListX, _ui.target.width, 0.5f)
  621. .SetTarget(_ui.m_partsListSearch.target)
  622. .OnUpdate((GTweener t) =>
  623. {
  624. _ui.m_partsListSearch.target.x = t.value.x;
  625. });
  626. }
  627. /****************************************************************************************************************************/
  628. private void DressResetSerch()
  629. {
  630. if (currentListType == DressUpListType.List5)
  631. {
  632. OnTouchPad();
  633. }
  634. }
  635. private void UpdateSearch(EventContext context)
  636. {
  637. if (context.data.ToString() == ConstMessage.DRESS_SEARCH)
  638. {
  639. _currentList3 = DressUpMenuItemDataManager.DressSearch();
  640. }
  641. else if (context.data.ToString() == ConstMessage.DRESS_FILTER)
  642. {
  643. _currentList3 = DressUpMenuItemDataManager.DressFilter();
  644. }
  645. ViewManager.Hide<ModalStatusView>();
  646. UpdateSearchList();
  647. if (currentListType != DressUpListType.List5)
  648. {
  649. hideListParts();
  650. hideListParts2();
  651. hideListType1();
  652. hideListType2();
  653. showSearchListType();
  654. }
  655. _currentMenuType = 0;
  656. }
  657. private void UpdateSearchList()
  658. {
  659. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  660. {
  661. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighRarity(_currentList3);
  662. }
  663. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  664. {
  665. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowRarity(_currentList3);
  666. }
  667. _currentMenuType = 0;
  668. _ui.m_partsListSearch.m_list.numItems = _currentList3.Count;
  669. }
  670. private void ListType1Item(int index, GObject item)
  671. {
  672. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  673. DressUpMenuItemCfg1 item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index];
  674. if(this.viewData != null && (int)this.viewData == 2)
  675. {
  676. if(index == DressUpMenuItemCfg1Array.Instance.dataArray.Length - 4)
  677. {
  678. item1 = DressUpMenuItemCfg1Array.Instance.dataArray[index+1];
  679. }
  680. }
  681. typeItem.m_icon.url = "ui://DressUp/hz_fenleitu_" + item1.id;
  682. typeItem.m_txtname.text = item1.name;
  683. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconzi_" + item1.id;
  684. typeItem.target.data = item1.id;
  685. typeItem.m_imgNeed.visible = false;
  686. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsFirstMenuNew(item1.id);
  687. UI_TypeItem.ProxyEnd();
  688. }
  689. private void ListType2Item(int index, GObject item)
  690. {
  691. UI_TypeItem typeItem = UI_TypeItem.Proxy(item);
  692. DressUpMenuItemCfg2 item2 = DressUpMenuItemCfg2Array.Instance.dataArray[_currentList2[index] - 1];
  693. typeItem.m_icon.url = "ui://DressUp/hz_fenleituej_" + item2.id;
  694. typeItem.m_txtname.text = item2.name;
  695. //typeItem.m_imgTitle.url = "ui://DressUp/hz_iconziej_" + item2.id;
  696. typeItem.target.data = item2.id;
  697. typeItem.m_imgNeed.visible = false;
  698. typeItem.m_imgNew.visible = DressUpMenuItemDataManager.CheckIsSecondMenuNew(item2.id);
  699. UI_TypeItem.ProxyEnd();
  700. }
  701. private void ListPartsItem(int index, GObject item)
  702. {
  703. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  704. int id = (int)_currentList3[index];
  705. string iconRes = "";
  706. string partName = "";
  707. string ext = "png";
  708. listItem.m_btnAni.visible = false;
  709. Debug.Log("id:" + id + " _currentMenuType:" + _currentMenuType);
  710. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  711. {
  712. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  713. iconRes = suitCfg.res;
  714. partName = suitCfg.name;
  715. listItem.m_iconSelected.visible = false;
  716. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  717. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.rarity;
  718. listItem.m_ScoreType.visible = false;
  719. listItem.m_imgNew.visible = false;
  720. bool SuitHasAction = SuitCfgArray.Instance.CheckSuitHasAction(id);
  721. bool HasActionRes = DressUpMenuSuitDataManager.CheckSuitHasActionRes(id);
  722. Debug.Log("SuitHasAction:" + SuitHasAction + " HasActionRes:" + HasActionRes + " suitCfg.res" + suitCfg.aniRes);
  723. listItem.m_btnAni.visible = SuitCfgArray.Instance.CheckSuitHasAction(id) && DressUpMenuSuitDataManager.CheckSuitHasActionRes(id);
  724. // listItem.m_comAxtionSelect.m_btnNormal.icon = ResPathUtil.GetIconPath(suitCfg.res, ext);
  725. // listItem.m_comAxtionSelect.m_btnAction.icon = ResPathUtil.GetIconPath(suitCfg.res, ext);
  726. if (listItem.m_btnAni.data == null)
  727. {
  728. listItem.m_btnAni.onClick.Add(OnBtnActionClick);
  729. }
  730. listItem.m_btnAni.data = id;
  731. }
  732. else if (_currentMenuType == (int)ConstDressUpItemType.DONG_ZUO)
  733. {
  734. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  735. iconRes = suitCfg.res;
  736. partName = suitCfg.name;
  737. listItem.m_iconSelected.visible = false;
  738. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, true);
  739. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + suitCfg.rarity;
  740. listItem.m_ScoreType.visible = false;
  741. listItem.m_imgNew.visible = false;
  742. }
  743. else
  744. {
  745. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  746. iconRes = itemCfg.res;
  747. partName = itemCfg.name;
  748. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  749. listItem.m_loaBorder.url = "ui://DressUp/hz_kuangk_" + itemCfg.rarity;
  750. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false);
  751. // ext = ItemUtil.GetItemResExt(itemCfg.itemType, itemCfg.subType, true);
  752. listItem.m_ScoreType.visible = true;
  753. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + itemCfg.mainScore);
  754. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  755. listItem.m_imgNew.visible = isNew;
  756. if (isNew)
  757. {
  758. ItemProxy.ReqSetItemRead(id).Coroutine();
  759. }
  760. }
  761. if (listItem.m_icon.data == null)
  762. {
  763. listItem.m_icon.onClick.Add(OnClickPartsListItem);
  764. }
  765. listItem.m_icon.data = id;
  766. if (listItem.target.data == null)
  767. {
  768. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  769. longPressGesture.trigger = GameConfig.LongPressGestureTrigger;
  770. longPressGesture.once = true;
  771. longPressGesture.onAction.Add(OnLongPress);
  772. _listLongPress.Add(longPressGesture);
  773. }
  774. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, ext);
  775. listItem.m_txtTitle.text = partName;
  776. listItem.target.data = id;
  777. listItem.m_grpScore.visible = false;
  778. //listItem.m_ScoreType.visible = true;
  779. listItem.m_imgNeed.visible = false;
  780. UI_PartsListItem.ProxyEnd();
  781. }
  782. private void ListParts2Item(int index, GObject item)
  783. {
  784. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  785. int id = (int)_currentList4[index];
  786. string iconRes = "";
  787. string partName = "";
  788. // string ext = "png";
  789. if (listItem.target.data == null)
  790. {
  791. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  792. longPressGesture.trigger = GameConfig.LongPressGestureTrigger;
  793. longPressGesture.once = true;
  794. longPressGesture.onAction.Add(OnLongPress);
  795. _listLongPress.Add(longPressGesture);
  796. }
  797. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  798. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  799. iconRes = itemCfg != null ? itemCfg.res : suitCfg.res;
  800. partName = itemCfg != null ? itemCfg.name : suitCfg.name;
  801. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  802. bool isAction = MyDressUpHelper.dressUpObj.IsAction && SuitCfgArray.Instance.CheckActionContainsItem(id, MyDressUpHelper.dressUpObj.actionId);
  803. listItem.m_iconSelected.visible = isPutOn || isAction;
  804. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, itemCfg == null);
  805. listItem.m_ScoreType.visible = false;
  806. if (itemCfg != null)
  807. {
  808. listItem.m_ScoreType.visible = true;
  809. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + itemCfg.mainScore);
  810. }
  811. listItem.m_btnAni.visible = false;
  812. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, "png");
  813. listItem.m_txtTitle.text = partName;
  814. listItem.target.data = id;
  815. listItem.m_grpScore.visible = false;
  816. //listItem.m_ScoreType.visible = true;
  817. listItem.m_imgNeed.visible = false;
  818. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  819. listItem.m_imgNew.visible = isNew;
  820. if (isNew)
  821. {
  822. ItemProxy.ReqSetItemRead(id).Coroutine();
  823. }
  824. UI_PartsListItem.ProxyEnd();
  825. }
  826. private void UpdateListPartsSelected(int selectSuitId = 0)
  827. {
  828. GList list;
  829. if (_ui.m_partsList.target.x == partsListX)
  830. {
  831. list = _ui.m_partsList.m_list;
  832. }
  833. else if (_ui.m_partsListSearch.target.x == partsListX)
  834. {
  835. list = _ui.m_partsListSearch.m_list;
  836. }
  837. else
  838. {
  839. return;
  840. }
  841. int count = list.numChildren;
  842. int suitId = MyDressUpHelper.dressUpObj.suitId;
  843. for (int i = 0; i < count; i++)
  844. {
  845. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(i));
  846. int id = (int)listItem.target.data;
  847. if (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG)
  848. {
  849. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  850. }
  851. else if (_currentMenuType == ConstDressUpItemType.DONG_ZUO)
  852. {
  853. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.IsAction && MyDressUpHelper.dressUpObj.actionId == id;
  854. }
  855. else
  856. {
  857. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  858. bool isAction = MyDressUpHelper.dressUpObj.IsAction && SuitCfgArray.Instance.CheckActionContainsItem(id, MyDressUpHelper.dressUpObj.actionId);
  859. listItem.m_iconSelected.visible = isPutOn || isAction;
  860. }
  861. UI_PartsListItem.ProxyEnd();
  862. }
  863. }
  864. private void UpdateListSuitPartsSelected()
  865. {
  866. int count = _ui.m_partsList2.m_list.numChildren;
  867. for (int i = 0; i < count; i++)
  868. {
  869. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  870. int id = (int)listItem.target.data;
  871. bool isSuitSelect = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//可换部件是否穿戴
  872. bool isActionSelect = MyDressUpHelper.dressUpObj.actionId == id;
  873. listItem.m_iconSelected.visible = isSuitSelect || isActionSelect;
  874. UI_PartsListItem.ProxyEnd();
  875. }
  876. }
  877. private void UpdatePartsListSort()
  878. {
  879. if (_currentMenuType == 0) return;
  880. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  881. {
  882. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  883. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  884. {
  885. _currentList3 = SuitUtil.SortSuitListByHighRarity(_currentList3);
  886. }
  887. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  888. {
  889. _currentList3 = SuitUtil.SortSuitListByLowRarity(_currentList3);
  890. }
  891. else
  892. {
  893. _currentList3.Reverse();
  894. }
  895. }
  896. else if (_currentMenuType == (int)ConstDressUpItemType.DONG_ZUO)
  897. {
  898. _currentList3 = DressUpMenuSuitDataManager.GetActionIDList();
  899. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  900. {
  901. _currentList3 = SuitUtil.SortSuitListByHighRarity(_currentList3);
  902. }
  903. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  904. {
  905. _currentList3 = SuitUtil.SortSuitListByLowRarity(_currentList3);
  906. }
  907. else
  908. {
  909. _currentList3.Reverse();
  910. }
  911. }
  912. else
  913. {
  914. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  915. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  916. {
  917. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighRarity(_currentList3);
  918. }
  919. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  920. {
  921. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowRarity(_currentList3);
  922. }
  923. else
  924. {
  925. _currentList3.Reverse();
  926. }
  927. }
  928. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  929. // {
  930. // _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
  931. // }
  932. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  933. // {
  934. // _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
  935. // }
  936. _ui.m_partsList.m_list.RemoveChildrenToPool();
  937. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  938. }
  939. private void UpdateSuitPartsListSort()
  940. {
  941. if (_currentMenuType == 0) return;
  942. if (_isNormalSuitType)
  943. {
  944. _currentList4 = new List<int>(SuitCfgArray.Instance.GetSuitItems(_currentSuitId));
  945. }
  946. else
  947. {
  948. _currentList4 = SuitCfgArray.Instance.GetOneSuitAllNotActionParts(_currentSuitId);
  949. _currentList4.Add(_currentSuitId);
  950. }
  951. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  952. // {
  953. // _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4);
  954. // }
  955. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  956. // {
  957. // _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4);
  958. // }
  959. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  960. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  961. }
  962. private void UpdateBtnAction()
  963. {
  964. // _ui.m_btnAction.visible = (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG) || this.currentListType == DressUpListType.List4;
  965. // if (_ui.m_btnAction.visible)
  966. // {
  967. //_ui.m_btnAction.grayed = !EquipDataCache.cacher.HasSuitActionRes;
  968. // }
  969. }
  970. private void OnClickBtnShow()
  971. {
  972. Timers.inst.Remove(SetBtnShowVisable);
  973. _ui.m_c1.selectedIndex = 0;
  974. _ui.m_btnHide.visible = true;
  975. _ui.m_btnShow.visible = false;
  976. _ui.m_loaShow.visible = false;
  977. }
  978. private void OnClickBtnHide()
  979. {
  980. _ui.m_c1.selectedIndex = 1;
  981. _ui.m_btnHide.visible = false;
  982. _ui.m_btnShow.visible = true;
  983. _ui.m_loaShow.visible = true;
  984. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  985. }
  986. private void OnClickLoaShow()
  987. {
  988. _ui.m_btnShow.alpha = 1;
  989. _ui.m_btnShow.enabled = true;
  990. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  991. }
  992. private void OnClickBtnPhoto()
  993. {
  994. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.PAI_ZHAO, 1);
  995. if (!ViewManager.Show<PhotographView>())
  996. {
  997. return;
  998. }
  999. _ui.target.visible = false;
  1000. this._sceneObject.gameObject.SetActive(false);
  1001. }
  1002. private void OnClickBtnNext()
  1003. {
  1004. // if (!EquipDataCache.cacher.CheckPutOnFinish())
  1005. // {
  1006. // AlertUI.Show("只有换好衣服才能出门哦!")
  1007. // .SetRightButton(true, "好的");
  1008. // return;
  1009. // }
  1010. if (!ViewManager.Show<PhotographView>(this.viewData))
  1011. {
  1012. return;
  1013. }
  1014. if (this.viewData != null && (int)this.viewData == 2)
  1015. {
  1016. ViewManager.Show<LoadingView>();
  1017. LoadingView.Instance.SetDesc("正在摆放道具...");
  1018. Timers.inst.StartCoroutine(UpdateLoadProgress());
  1019. }
  1020. _ui.target.visible = false;
  1021. this._sceneObject.gameObject.SetActive(false);
  1022. }
  1023. private IEnumerator UpdateLoadProgress()
  1024. {
  1025. yield return new WaitForEndOfFrame();
  1026. LoadingView.Instance.SetProgress(100, () =>
  1027. {
  1028. ViewManager.Hide<LoadingView>();
  1029. }
  1030. );
  1031. }
  1032. private void UpdateScene()
  1033. {
  1034. _ui.target.visible = true;
  1035. this._sceneObject.gameObject.SetActive(true);
  1036. }
  1037. private void SetBtnShowVisable(object param)
  1038. {
  1039. _ui.m_btnShow.enabled = false;
  1040. GTween.To(1, 0, 0.3f).SetTarget(_ui.m_btnShow, TweenPropType.Alpha);
  1041. }
  1042. private bool CheckListCount(int type)
  1043. {
  1044. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  1045. {
  1046. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  1047. }
  1048. else
  1049. {
  1050. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  1051. }
  1052. }
  1053. private void CheckGuide(object param)
  1054. {
  1055. if (GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0
  1056. || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER) <= 0)
  1057. {
  1058. UpdateToCheckGuide(null);
  1059. }
  1060. else
  1061. {
  1062. Timers.inst.Remove(CheckGuide);
  1063. }
  1064. }
  1065. protected override void UpdateToCheckGuide(object param)
  1066. {
  1067. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  1068. if (listTypeItem_FreedomDress == null && GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0)
  1069. {
  1070. int len = _ui.m_comListType1.m_listType.numChildren;
  1071. for (int i = 0; i < len; i++)
  1072. {
  1073. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  1074. if (item != null)
  1075. {
  1076. int menuID = (int)item.target.data;
  1077. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  1078. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  1079. {
  1080. listTypeItem_FreedomDress = item;
  1081. _ui.m_comListType1.m_listType.ScrollToView(i);
  1082. break;
  1083. }
  1084. }
  1085. UI_TypeItem.ProxyEnd();
  1086. }
  1087. }
  1088. if (listTypeItem_FreedomDress != null) GuideController.TryGuide(listTypeItem_FreedomDress.target, ConstGuideId.FREEDOM_DRESS, 3, "套装分类里,可以查看集齐成套的服饰,点击一键换上。");
  1089. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.FREEDOM_DRESS, 4, "", 0);
  1090. // if (_ui.m_partsList.m_list.numItems > 0)
  1091. // {
  1092. // UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(0).asCom);
  1093. // GuideController.TryGuide(listItem.m_comAxtionSelect.m_btnAction, ConstGuideId.FREEDOM_DRESS, 5, "选择特殊动作并穿上。");
  1094. // UI_PartsListItem.ProxyEnd();
  1095. // }
  1096. GuideController.TryGuide(_ui.m_btnSave, ConstGuideId.FREEDOM_DRESS, 5, "搭配好的服饰,可以保存到主界面显示。");
  1097. GuideController.TryGuide(_ui.m_btnPhoto, ConstGuideId.FREEDOM_DRESS, 6, "辛苦搭配完,去拍个照片留念呀~~");
  1098. GuideController.TryGuide(_ui.m_btnBack, ConstGuideId.ENTER_CHAPTER, 2, "");
  1099. }
  1100. }
  1101. }