DressUpView.cs 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212
  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. listItem.m_lock.visible = false;
  784. UI_PartsListItem.ProxyEnd();
  785. }
  786. private void ListParts2Item(int index, GObject item)
  787. {
  788. UI_PartsListItem listItem = UI_PartsListItem.Proxy(item);
  789. int id = (int)_currentList4[index];
  790. string iconRes = "";
  791. string partName = "";
  792. // string ext = "png";
  793. if (listItem.target.data == null)
  794. {
  795. LongPressGesture longPressGesture = new LongPressGesture(listItem.target);
  796. longPressGesture.trigger = GameConfig.LongPressGestureTrigger;
  797. longPressGesture.once = true;
  798. longPressGesture.onAction.Add(OnLongPress);
  799. _listLongPress.Add(longPressGesture);
  800. }
  801. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(id);
  802. SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(id);
  803. iconRes = itemCfg != null ? itemCfg.res : suitCfg.res;
  804. partName = itemCfg != null ? itemCfg.name : suitCfg.name;
  805. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  806. bool isAction = MyDressUpHelper.dressUpObj.IsAction && SuitCfgArray.Instance.CheckActionContainsItem(id, MyDressUpHelper.dressUpObj.actionId);
  807. listItem.m_iconSelected.visible = isPutOn || isAction;
  808. RarityIconController.UpdateRarityIcon(listItem.m_rarity, id, false, itemCfg == null);
  809. listItem.m_ScoreType.visible = false;
  810. if (itemCfg != null)
  811. {
  812. listItem.m_ScoreType.visible = true;
  813. listItem.m_ScoreType.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + itemCfg.mainScore);
  814. }
  815. listItem.m_btnAni.visible = false;
  816. listItem.m_icon.url = ResPathUtil.GetIconPath(iconRes, "png");
  817. listItem.m_txtTitle.text = partName;
  818. listItem.target.data = id;
  819. listItem.m_grpScore.visible = false;
  820. //listItem.m_ScoreType.visible = true;
  821. listItem.m_imgNeed.visible = false;
  822. bool isNew = DressUpMenuItemDataManager.CheckIsDressUpItemNew(id);
  823. listItem.m_imgNew.visible = isNew;
  824. listItem.m_lock.visible = false;
  825. if (isNew)
  826. {
  827. ItemProxy.ReqSetItemRead(id).Coroutine();
  828. }
  829. UI_PartsListItem.ProxyEnd();
  830. }
  831. private void UpdateListPartsSelected(int selectSuitId = 0)
  832. {
  833. GList list;
  834. if (_ui.m_partsList.target.x == partsListX)
  835. {
  836. list = _ui.m_partsList.m_list;
  837. }
  838. else if (_ui.m_partsListSearch.target.x == partsListX)
  839. {
  840. list = _ui.m_partsListSearch.m_list;
  841. }
  842. else
  843. {
  844. return;
  845. }
  846. int count = list.numChildren;
  847. int suitId = MyDressUpHelper.dressUpObj.suitId;
  848. for (int i = 0; i < count; i++)
  849. {
  850. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(i));
  851. int id = (int)listItem.target.data;
  852. if (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG)
  853. {
  854. listItem.m_iconSelected.visible = suitId > 0 && id == suitId;
  855. }
  856. else if (_currentMenuType == ConstDressUpItemType.DONG_ZUO)
  857. {
  858. listItem.m_iconSelected.visible = MyDressUpHelper.dressUpObj.IsAction && MyDressUpHelper.dressUpObj.actionId == id;
  859. }
  860. else
  861. {
  862. bool isPutOn = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);
  863. bool isAction = MyDressUpHelper.dressUpObj.IsAction && SuitCfgArray.Instance.CheckActionContainsItem(id, MyDressUpHelper.dressUpObj.actionId);
  864. listItem.m_iconSelected.visible = isPutOn || isAction;
  865. }
  866. UI_PartsListItem.ProxyEnd();
  867. }
  868. }
  869. private void UpdateListSuitPartsSelected()
  870. {
  871. int count = _ui.m_partsList2.m_list.numChildren;
  872. for (int i = 0; i < count; i++)
  873. {
  874. UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList2.m_list.GetChildAt(i));
  875. int id = (int)listItem.target.data;
  876. bool isSuitSelect = MyDressUpHelper.dressUpObj.CheckDressUpItemIsOn(id);//可换部件是否穿戴
  877. bool isActionSelect = MyDressUpHelper.dressUpObj.actionId == id;
  878. listItem.m_iconSelected.visible = isSuitSelect || isActionSelect;
  879. UI_PartsListItem.ProxyEnd();
  880. }
  881. }
  882. private void UpdatePartsListSort()
  883. {
  884. if (_currentMenuType == 0) return;
  885. if (_currentMenuType == (int)ConstDressUpItemType.TAO_ZHUANG)
  886. {
  887. _currentList3 = DressUpMenuSuitDataManager.GetSuitIDList();
  888. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  889. {
  890. _currentList3 = SuitUtil.SortSuitListByHighRarity(_currentList3);
  891. }
  892. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  893. {
  894. _currentList3 = SuitUtil.SortSuitListByLowRarity(_currentList3);
  895. }
  896. else
  897. {
  898. _currentList3.Reverse();
  899. }
  900. }
  901. else if (_currentMenuType == (int)ConstDressUpItemType.DONG_ZUO)
  902. {
  903. _currentList3 = DressUpMenuSuitDataManager.GetActionIDList();
  904. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  905. {
  906. _currentList3 = SuitUtil.SortSuitListByHighRarity(_currentList3);
  907. }
  908. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  909. {
  910. _currentList3 = SuitUtil.SortSuitListByLowRarity(_currentList3);
  911. }
  912. else
  913. {
  914. _currentList3.Reverse();
  915. }
  916. }
  917. else
  918. {
  919. _currentList3 = DressUpMenuItemDataManager.getItemDatasByType(_currentMenuType);
  920. if (_rarityIndex == SORT_BY_HIGH_RARITY)
  921. {
  922. _currentList3 = DressUpMenuItemDataManager.SortItemListByHighRarity(_currentList3);
  923. }
  924. else if (_rarityIndex == SORT_BY_LOW_RARITY)
  925. {
  926. _currentList3 = DressUpMenuItemDataManager.SortItemListByLowRarity(_currentList3);
  927. }
  928. else
  929. {
  930. _currentList3.Reverse();
  931. }
  932. }
  933. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  934. // {
  935. // _currentList3 = DressUpMenuItemDataManager.DressSearch(_currentList3);
  936. // }
  937. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  938. // {
  939. // _currentList3 = DressUpMenuItemDataManager.DressFilter(_currentList3);
  940. // }
  941. _ui.m_partsList.m_list.RemoveChildrenToPool();
  942. _ui.m_partsList.m_list.numItems = _currentList3.Count;
  943. }
  944. private void UpdateSuitPartsListSort()
  945. {
  946. if (_currentMenuType == 0) return;
  947. if (_isNormalSuitType)
  948. {
  949. _currentList4 = new List<int>(SuitCfgArray.Instance.GetSuitItems(_currentSuitId));
  950. }
  951. else
  952. {
  953. _currentList4 = SuitCfgArray.Instance.GetOneSuitAllNotActionParts(_currentSuitId);
  954. _currentList4.Add(_currentSuitId);
  955. }
  956. // if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Search)
  957. // {
  958. // _currentList4 = DressUpMenuItemDataManager.DressSearch(_currentList4);
  959. // }
  960. // else if (DressUpMenuItemDataManager.dressFilterType == DressFilterType.Filter)
  961. // {
  962. // _currentList4 = DressUpMenuItemDataManager.DressFilter(_currentList4);
  963. // }
  964. _ui.m_partsList2.m_list.RemoveChildrenToPool();
  965. _ui.m_partsList2.m_list.numItems = _currentList4.Count;
  966. }
  967. private void UpdateBtnAction()
  968. {
  969. // _ui.m_btnAction.visible = (_currentMenuType == ConstDressUpItemType.TAO_ZHUANG) || this.currentListType == DressUpListType.List4;
  970. // if (_ui.m_btnAction.visible)
  971. // {
  972. //_ui.m_btnAction.grayed = !EquipDataCache.cacher.HasSuitActionRes;
  973. // }
  974. }
  975. private void OnClickBtnShow()
  976. {
  977. Timers.inst.Remove(SetBtnShowVisable);
  978. _ui.m_c1.selectedIndex = 0;
  979. _ui.m_btnHide.visible = true;
  980. _ui.m_btnShow.visible = false;
  981. _ui.m_loaShow.visible = false;
  982. }
  983. private void OnClickBtnHide()
  984. {
  985. _ui.m_c1.selectedIndex = 1;
  986. _ui.m_btnHide.visible = false;
  987. _ui.m_btnShow.visible = true;
  988. _ui.m_loaShow.visible = true;
  989. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  990. }
  991. private void OnClickLoaShow()
  992. {
  993. _ui.m_btnShow.alpha = 1;
  994. _ui.m_btnShow.enabled = true;
  995. Timers.inst.Add(2f, 1, SetBtnShowVisable);
  996. }
  997. private void OnClickBtnPhoto()
  998. {
  999. LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.PAI_ZHAO, 1);
  1000. if (!ViewManager.Show<PhotographView>())
  1001. {
  1002. return;
  1003. }
  1004. _ui.target.visible = false;
  1005. this._sceneObject.gameObject.SetActive(false);
  1006. }
  1007. private void OnClickBtnNext()
  1008. {
  1009. // if (!EquipDataCache.cacher.CheckPutOnFinish())
  1010. // {
  1011. // AlertUI.Show("只有换好衣服才能出门哦!")
  1012. // .SetRightButton(true, "好的");
  1013. // return;
  1014. // }
  1015. if (!ViewManager.Show<PhotographView>(this.viewData))
  1016. {
  1017. return;
  1018. }
  1019. if (this.viewData != null && (int)this.viewData == 2)
  1020. {
  1021. ViewManager.Show<LoadingView>();
  1022. LoadingView.Instance.SetDesc("正在摆放道具...");
  1023. Timers.inst.StartCoroutine(UpdateLoadProgress());
  1024. }
  1025. _ui.target.visible = false;
  1026. this._sceneObject.gameObject.SetActive(false);
  1027. }
  1028. private IEnumerator UpdateLoadProgress()
  1029. {
  1030. yield return new WaitForEndOfFrame();
  1031. LoadingView.Instance.SetProgress(100, () =>
  1032. {
  1033. ViewManager.Hide<LoadingView>();
  1034. }
  1035. );
  1036. }
  1037. private void UpdateScene()
  1038. {
  1039. _ui.target.visible = true;
  1040. this._sceneObject.gameObject.SetActive(true);
  1041. }
  1042. private void SetBtnShowVisable(object param)
  1043. {
  1044. _ui.m_btnShow.enabled = false;
  1045. GTween.To(1, 0, 0.3f).SetTarget(_ui.m_btnShow, TweenPropType.Alpha);
  1046. }
  1047. private bool CheckListCount(int type)
  1048. {
  1049. if (type == (int)ConstDressUpItemType.TAO_ZHUANG)
  1050. {
  1051. return DressUpMenuSuitDataManager.GetSuitIDList().Count > 0;
  1052. }
  1053. else
  1054. {
  1055. return DressUpMenuItemDataManager.getItemDatasByType(type).Count > 0;
  1056. }
  1057. }
  1058. private void CheckGuide(object param)
  1059. {
  1060. if (GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0
  1061. || GuideDataManager.IsGuideFinish(ConstGuideId.ENTER_CHAPTER) <= 0)
  1062. {
  1063. UpdateToCheckGuide(null);
  1064. }
  1065. else
  1066. {
  1067. Timers.inst.Remove(CheckGuide);
  1068. }
  1069. }
  1070. protected override void UpdateToCheckGuide(object param)
  1071. {
  1072. if (!ViewManager.CheckIsTopView(this.viewCom)) return;
  1073. if (listTypeItem_FreedomDress == null && GuideDataManager.IsGuideFinish(ConstGuideId.FREEDOM_DRESS) <= 0)
  1074. {
  1075. int len = _ui.m_comListType1.m_listType.numChildren;
  1076. for (int i = 0; i < len; i++)
  1077. {
  1078. UI_TypeItem item = UI_TypeItem.Proxy(_ui.m_comListType1.m_listType.GetChildAt(i));
  1079. if (item != null)
  1080. {
  1081. int menuID = (int)item.target.data;
  1082. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  1083. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  1084. {
  1085. listTypeItem_FreedomDress = item;
  1086. _ui.m_comListType1.m_listType.ScrollToView(i);
  1087. break;
  1088. }
  1089. }
  1090. UI_TypeItem.ProxyEnd();
  1091. }
  1092. }
  1093. if (listTypeItem_FreedomDress != null) GuideController.TryGuide(listTypeItem_FreedomDress.target, ConstGuideId.FREEDOM_DRESS, 3, "套装分类里,可以查看集齐成套的服饰,点击一键换上。");
  1094. GuideController.TryGuide(_ui.m_partsList.m_list, ConstGuideId.FREEDOM_DRESS, 4, "", 0);
  1095. // if (_ui.m_partsList.m_list.numItems > 0)
  1096. // {
  1097. // UI_PartsListItem listItem = UI_PartsListItem.Proxy(_ui.m_partsList.m_list.GetChildAt(0).asCom);
  1098. // GuideController.TryGuide(listItem.m_comAxtionSelect.m_btnAction, ConstGuideId.FREEDOM_DRESS, 5, "选择特殊动作并穿上。");
  1099. // UI_PartsListItem.ProxyEnd();
  1100. // }
  1101. GuideController.TryGuide(_ui.m_btnSave, ConstGuideId.FREEDOM_DRESS, 5, "搭配好的服饰,可以保存到主界面显示。");
  1102. GuideController.TryGuide(_ui.m_btnPhoto, ConstGuideId.FREEDOM_DRESS, 6, "辛苦搭配完,去拍个照片留念呀~~");
  1103. GuideController.TryGuide(_ui.m_btnBack, ConstGuideId.ENTER_CHAPTER, 2, "");
  1104. }
  1105. }
  1106. }