GuideController.cs 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. using FairyGUI;
  2. using UI.DressUp;
  3. using UI.Main;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using UI.ClothingSynthetic;
  7. namespace GFGGame
  8. {
  9. public class GuideController
  10. {
  11. /*******************************************************单人战斗引导***********************************************/
  12. public static void TryGuideChapterViewLevelItem(GObject target, string guideStr = null)
  13. {
  14. if (GuideDataManager.GetGuideCount(ConstGuideId.SINGLE_FIGHT_GUIDE) <= 0)
  15. {
  16. if (guideStr == null)
  17. {
  18. UI_CompStoryLevelItem levelItem = UI_CompStoryLevelItem.Proxy(target);
  19. if (levelItem != null)
  20. {
  21. int level = int.Parse(levelItem.target.name.Replace("g", ""));
  22. string levelID = StoryDataManager.currentChapter + "_" + level;
  23. StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(levelID);
  24. if (storyLevelCfg.fightID != null && storyLevelCfg.fightID.Length > 0)
  25. {
  26. guideStr = "点击关卡图标,继续挑战";
  27. }
  28. else
  29. {
  30. guideStr = "点击关卡图标,继续故事";
  31. }
  32. }
  33. else
  34. {
  35. guideStr = "点击,继续";
  36. }
  37. }
  38. GuideDataManager.currentGuideId = ConstGuideId.SINGLE_FIGHT_GUIDE;
  39. ShowGuide(target, true, guideStr);
  40. }
  41. }
  42. public static void TryGuideChapterInfoViewBtnStart(GObject target, string guideStr = null)
  43. {
  44. if (GuideDataManager.GetGuideCount(ConstGuideId.SINGLE_FIGHT_GUIDE) <= 0)
  45. {
  46. if (guideStr == null)
  47. {
  48. guideStr = "点击,继续";
  49. }
  50. ShowGuide(target, true, guideStr);
  51. }
  52. }
  53. public static bool TryGuideDressUpFightViewMenuType0(GList list)
  54. {
  55. if (StoryDataManager.currentChapter == 1 && StoryDataManager.currentLevel <= 2
  56. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  57. {
  58. int len = list.numChildren;
  59. for (int i = 0; i < len; i++)
  60. {
  61. UI_TypeItem item = UI_TypeItem.Proxy(list.GetChildAt(i));
  62. if (item != null)
  63. {
  64. int menuID = (int)item.target.data;
  65. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  66. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.LIAN_YI_QUN)
  67. {
  68. ShowGuide(item.target, true, "点击分类图标,可查看对应类型的服装");
  69. return true;
  70. }
  71. }
  72. }
  73. }
  74. return false;
  75. }
  76. public static void TryGuideDressUpFightViewMenuPart0(GList list, string guideStr)
  77. {
  78. if (StoryDataManager.currentChapter == 1 && StoryDataManager.currentLevel <= 2
  79. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  80. {
  81. if (list.numChildren > 0)
  82. {
  83. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  84. if (listItem != null)
  85. {
  86. ShowGuide(listItem.target, true, guideStr);
  87. return;
  88. }
  89. }
  90. }
  91. }
  92. public static void TryGuideDressUpFightViewBtnNext0(GObject target)
  93. {
  94. if (GuideDataManager.GetGuideCount(ConstGuideId.SINGLE_FIGHT_GUIDE) <= 0)
  95. {
  96. ShowGuide(target, false, "换好衣服后,点击下一步进行战斗");
  97. }
  98. }
  99. public static void TryGuideSingleScoreViewComClickCircle(GObject target)
  100. {
  101. ShowGuide(target, false, "点击圆圈进行部件评分,精准率越高,部件额外加分越高哦");
  102. }
  103. /*******************************************************引导购买必需品***********************************************/
  104. public static void TryGuideDressUpFightViewBtnRecommend(GObject target, GList list)
  105. {
  106. _list = list;
  107. if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0
  108. && StoryDataManager.currentLevel == 4
  109. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel)
  110. && DressUpMenuItemDataManager.GetRecommendCount() >= 2)
  111. {
  112. GuideDataManager.currentGuideId = ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY;
  113. ShowGuide(target, false, "想要通过此关要穿戴提示的必需品哦,点击必需品提示看看");
  114. }
  115. }
  116. public static void TryGuideApproachOfItemViewList(GList list)
  117. {
  118. if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0
  119. && StoryDataManager.currentLevel == 4
  120. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel)
  121. && DressUpMenuItemDataManager.GetRecommendCount() >= 2)
  122. {
  123. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  124. if (listItem != null)
  125. {
  126. ShowGuide(listItem.target, false, "这里是物品产出的所有来源,点击服装店");
  127. }
  128. }
  129. }
  130. public static void TryGuideClothingShopViewBtnBug(GObject target)
  131. {
  132. if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0
  133. && StoryDataManager.currentLevel == 4
  134. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel)
  135. && DressUpMenuItemDataManager.GetRecommendCount() >= 2)
  136. {
  137. ShowGuide(target, false, "已经选中需要的衣服,点击购买");
  138. }
  139. }
  140. public static void TryGuideBuyCountViewBtnSure(GObject target)
  141. {
  142. if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0
  143. && StoryDataManager.currentLevel == 4
  144. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  145. {
  146. ShowGuide(target, false, "点击购买");
  147. }
  148. }
  149. public static void TryGuideClothingShopViewBtnBack(GObject target)
  150. {
  151. if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0
  152. && StoryDataManager.currentLevel == 4
  153. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  154. {
  155. ShowGuide(target, false, "点击返回,继续搭配衣服");
  156. }
  157. }
  158. private static GList _list;
  159. public static bool TryGuideDressUpFightViewMenuType1()
  160. {
  161. if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0
  162. && StoryDataManager.currentLevel == 4
  163. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  164. {
  165. int len = _list.numChildren;
  166. for (int i = 0; i < len; i++)
  167. {
  168. UI_TypeItem item = UI_TypeItem.Proxy(_list.GetChildAt(i));
  169. if (item != null)
  170. {
  171. int menuID = (int)item.target.data;
  172. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  173. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.LIAN_YI_QUN)
  174. {
  175. ShowGuide(item.target, true, "点击必需品图标");
  176. _list = null;
  177. return true;
  178. }
  179. }
  180. }
  181. }
  182. return false;
  183. }
  184. public static void TryGuideDressUpFightViewMenuPart1(GList list, string guideStr)
  185. {
  186. if (StoryDataManager.currentChapter == 1 && StoryDataManager.currentLevel == 4
  187. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  188. {
  189. if (list.numChildren > 0)
  190. {
  191. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  192. if (listItem != null)
  193. {
  194. ShowGuide(listItem.target, true, guideStr);
  195. return;
  196. }
  197. }
  198. }
  199. }
  200. /***************************************************点击查看关卡提示***************************************************/
  201. public static void TryGuideDressUpFightViewBtnHint(GObject target)
  202. {
  203. if (GuideDataManager.GetGuideCount(ConstGuideId.SEE_DRESS_TIPS) <= 0
  204. && StoryDataManager.currentLevel == 6
  205. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  206. {
  207. GuideDataManager.currentGuideId = ConstGuideId.SEE_DRESS_TIPS;
  208. ShowGuide(target, false, "点击查看过关提示");
  209. }
  210. }
  211. /******************************************************双人对战评分************************************************/
  212. public static void TryGuideStoryFightTargetScoreComCircle(GObject target, float devWidth, float devHeight)
  213. {
  214. if (GuideDataManager.GetGuideCount(ConstGuideId.TARGET_FIGHT_GUIDE) <= 0
  215. && StoryDataManager.currentLevel == 6
  216. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  217. {
  218. GuideDataManager.currentGuideId = ConstGuideId.TARGET_FIGHT_GUIDE;
  219. ShowGuide(target, false, "双人对战部件评分会显示在这里", 0, devWidth, devHeight);
  220. }
  221. }
  222. public static void TryGuideStoryFightTargetScorebtnSkill0(GObject target)
  223. {
  224. if (GuideDataManager.GetGuideCount(ConstGuideId.TARGET_FIGHT_GUIDE) <= 0
  225. && StoryDataManager.currentLevel == 6
  226. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  227. {
  228. ShowGuide(target, false, "点击使用技能");
  229. }
  230. }
  231. /*******************************************************引导抽奖***********************************************/
  232. public static bool TryGuideGoBackStoryChapter(GObject target)
  233. {
  234. Debug.Log(StoryDataManager.CheckLevelPass(1, 10));
  235. if (GuideDataManager.GetGuideCount(ConstGuideId.MAIN_UI_BTN_ZHAI_XING) <= 0
  236. && StoryDataManager.CheckLevelPass(1, 10)
  237. && !StoryDataManager.CheckLevelPass(1, 11))
  238. {
  239. GuideDataManager.currentGuideId = ConstGuideId.MAIN_UI_BTN_ZHAI_XING;
  240. ShowGuide(target, true, "点击返回主界面", 0);
  241. return true;
  242. }
  243. return false;
  244. }
  245. public static bool TryGuideLuckyBox(GObject target)
  246. {
  247. if (GuideDataManager.GetGuideCount(ConstGuideId.MAIN_UI_BTN_ZHAI_XING) <= 0
  248. && StoryDataManager.CheckLevelPass(1, 10)
  249. && !StoryDataManager.CheckLevelPass(1, 11))
  250. {
  251. GuideDataManager.currentGuideId = ConstGuideId.MAIN_UI_BTN_ZHAI_XING;
  252. ShowGuide(target, false, "点击摘星按钮,进入抽奖界面");
  253. return true;
  254. }
  255. return false;
  256. }
  257. public static bool TryGuideLuckyBoxStar()
  258. {
  259. if (GuideDataManager.GetGuideCount(ConstGuideId.MAIN_UI_BTN_ZHAI_XING) <= 0
  260. && StoryDataManager.CheckLevelPass(1, 10)
  261. && !StoryDataManager.CheckLevelPass(1, 11))
  262. {
  263. GuideDataManager.currentGuideId = ConstGuideId.MAIN_UI_BTN_ZHAI_XING;
  264. ShowGuide(null, false, "任选一颗星星按住不松手移动到下一颗星星,试着将所有星星连在一起", 1400);
  265. return true;
  266. }
  267. return false;
  268. }
  269. /*****************************************************引导自由换装保存套装*************************************************/
  270. public static bool TryGuideDressUpViewMenuType1(GList list)
  271. {
  272. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  273. {
  274. int len = list.numChildren;
  275. list.ScrollToView(len - 1);
  276. for (int i = 0; i < len; i++)
  277. {
  278. UI_TypeItem item = UI_TypeItem.Proxy(list.GetChildAt(i));
  279. if (item != null)
  280. {
  281. int menuID = (int)item.target.data;
  282. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  283. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  284. {
  285. ShowGuide(item.target, true, "点击套装分类,可查看收集的套装");
  286. return true;
  287. }
  288. }
  289. }
  290. }
  291. return false;
  292. }
  293. public static void TryGuideDressUpViewMenuPart(GList list)
  294. {
  295. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  296. {
  297. if (list.numChildren > 0)
  298. {
  299. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  300. if (listItem != null)
  301. {
  302. ShowGuide(listItem.target, true, "点击图标,可换上整套衣服");
  303. return;
  304. }
  305. }
  306. }
  307. }
  308. /************************************************************引导合成套装*******************************************************/
  309. public static void TryGuideStoryLevelInfoViewTxtNeed(GObject target)
  310. {
  311. if (GuideDataManager.GetGuideCount(ConstGuideId.SUIT_SYNTHETIC_GUIDE) <= 0
  312. && StoryDataManager.CheckLevelPass(2, 1)
  313. && !StoryDataManager.CheckLevelPass(2, 2)
  314. && StoryDataManager.currentChapter == 2 && StoryDataManager.currentLevel <= 2)
  315. {
  316. GuideDataManager.currentGuideId = ConstGuideId.SUIT_SYNTHETIC_GUIDE;
  317. ShowGuide(target, false, "还没有通关必须穿戴的衣服,快去合成一件吧!", 0);
  318. }
  319. }
  320. public static void TryGuideStoryLevelInfoView(GObject target)
  321. {
  322. if (GuideDataManager.GetGuideCount(ConstGuideId.SUIT_SYNTHETIC_GUIDE) <= 0
  323. && StoryDataManager.CheckLevelPass(2, 1)
  324. && !StoryDataManager.CheckLevelPass(2, 2))
  325. {
  326. ShowGuide(target, false, "点击空白处关闭", 1400);
  327. }
  328. }
  329. public static void TryGuideStoryChapterViewBtnHome(GObject target)
  330. {
  331. if (GuideDataManager.GetGuideCount(ConstGuideId.SUIT_SYNTHETIC_GUIDE) <= 0
  332. && StoryDataManager.CheckLevelPass(2, 1)
  333. && !StoryDataManager.CheckLevelPass(2, 2))
  334. {
  335. ShowGuide(target, false, "点击返回主界面", 0);
  336. }
  337. }
  338. public static void TryGuideMainUIViewBtnXiuFang(GObject target)
  339. {
  340. if (GuideDataManager.GetGuideCount(ConstGuideId.SUIT_SYNTHETIC_GUIDE) <= 0
  341. && StoryDataManager.CheckLevelPass(2, 1)
  342. && !StoryDataManager.CheckLevelPass(2, 2)
  343. // && GuideDataManager.currentGuideId == ConstGuideId.SUIT_SYNTHETIC_GUIDE
  344. )
  345. {
  346. GuideDataManager.currentGuideId = ConstGuideId.SUIT_SYNTHETIC_GUIDE;
  347. ShowGuide(target, false, "点击进入绣坊", 0);
  348. }
  349. }
  350. public static void TryGuideSuitSyntheticView(GObject target)
  351. {
  352. if (GuideDataManager.GetGuideCount(ConstGuideId.SUIT_SYNTHETIC_GUIDE) <= 0
  353. && StoryDataManager.CheckLevelPass(2, 1)
  354. && !StoryDataManager.CheckLevelPass(2, 2))
  355. {
  356. ShowGuide(target, false, "点击进入套装合成", 0);
  357. }
  358. }
  359. public static void TryGuideSuitSyntheticViewList(GList list)
  360. {
  361. if (GuideDataManager.GetGuideCount(ConstGuideId.SUIT_SYNTHETIC_GUIDE) <= 0
  362. && StoryDataManager.CheckLevelPass(2, 1)
  363. && !StoryDataManager.CheckLevelPass(2, 2))
  364. {
  365. if (list.numChildren > 0)
  366. {
  367. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  368. if (listItem != null)
  369. {
  370. ShowGuide(listItem.target, true, "点击套装");
  371. return;
  372. }
  373. }
  374. }
  375. }
  376. public static void TryGuideClothingSyntheticViewList(GList list)
  377. {
  378. if (GuideDataManager.GetGuideCount(ConstGuideId.SUIT_SYNTHETIC_GUIDE) <= 0
  379. && StoryDataManager.CheckLevelPass(2, 1)
  380. && !StoryDataManager.CheckLevelPass(2, 2))
  381. {
  382. if (list.numChildren > 0)
  383. {
  384. UI_MateriasListItem listItem = UI_MateriasListItem.Proxy(list.GetChildAt(0));
  385. if (listItem != null)
  386. {
  387. ShowGuide(listItem.m_loaderIcon, true, "点击查看制作材料");
  388. return;
  389. }
  390. }
  391. }
  392. }
  393. public static void TryGuideClothingSyntheticViewBtnProduction(GObject target)
  394. {
  395. if (GuideDataManager.GetGuideCount(ConstGuideId.SUIT_SYNTHETIC_GUIDE) <= 0
  396. && StoryDataManager.CheckLevelPass(2, 1)
  397. && !StoryDataManager.CheckLevelPass(2, 2))
  398. {
  399. ShowGuide(target, true, "点击进行制作");
  400. }
  401. }
  402. /************************************************************引导使用卡牌战斗*******************************************************/
  403. public static void TryGuideStoryCardChoose(GList list)
  404. {
  405. if (GuideDataManager.GetGuideCount(ConstGuideId.USE_CARD_FIGHT) <= 0
  406. && StoryDataManager.CheckLevelPass(2, 5)
  407. && !StoryDataManager.CheckLevelPass(2, 6)
  408. && StoryDataManager.currentChapter == 2 && StoryDataManager.currentLevel == 6)
  409. {
  410. if (list.numChildren > 0)
  411. {
  412. UI_ListCardItem listItem = UI_ListCardItem.Proxy(list.GetChildAt(0));
  413. if (listItem != null)
  414. {
  415. GuideDataManager.currentGuideId = ConstGuideId.USE_CARD_FIGHT;
  416. ShowGuide(listItem.target, true, "选择一张卡牌进行战斗");
  417. return;
  418. }
  419. }
  420. }
  421. }
  422. public static void TryGuideStoryCardChooseBtnConfirm(GObject target)
  423. {
  424. if (GuideDataManager.GetGuideCount(ConstGuideId.USE_CARD_FIGHT) <= 0
  425. && StoryDataManager.CheckLevelPass(2, 5)
  426. && !StoryDataManager.CheckLevelPass(2, 6))
  427. {
  428. ShowGuide(target, true, "点击确定进行战斗");
  429. }
  430. }
  431. /*******************************************************************************************************************/
  432. public static bool TryGuideByGuideId(GObject target, int guideId, int maxCount = 1, bool needUpdate = false, string guideStr = null, int yTxt = 0, int preGuideIdAtThisLogin = 0)
  433. {
  434. if (preGuideIdAtThisLogin > 0 && !GuideDataManager.CheckGuideIsCompletedAtThisLogin(preGuideIdAtThisLogin))
  435. {
  436. return false;
  437. }
  438. if (GuideDataManager.GetGuideCount(guideId) < maxCount)
  439. {
  440. GuideDataManager.currentGuideId = guideId;
  441. ShowGuide(target, needUpdate, guideStr, yTxt);
  442. return true;
  443. }
  444. return false;
  445. }
  446. public static bool TryCompleteGuide(int guideId)
  447. {
  448. bool result = GuideDataManager.TryCompleteGuide(guideId);
  449. if (result)
  450. {
  451. HideGuide();
  452. }
  453. return result;
  454. }
  455. public static void HideGuide()
  456. {
  457. ViewManager.Hide(ViewName.GUIDE_VIEW);
  458. }
  459. private static void ShowGuide(GObject target, bool needUpdate = false, string guideStr = null, int yTxt = 0, float devWidth = 0, float devHeight = 0)
  460. {
  461. HideGuide();
  462. if (GameGlobal.skipGuide)
  463. {
  464. return;
  465. }
  466. ViewManager.Show(ViewName.GUIDE_VIEW, new List<object> { target, needUpdate, guideStr, yTxt, devWidth, devHeight });
  467. }
  468. }
  469. }