DressUpView.cs 48 KB

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