GuideController.cs 19 KB

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