GuideController.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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. Debug.Log(StoryDataManager.currentLevel);
  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 TryGuideDressUpViewMenuType1(GList list)
  233. {
  234. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  235. {
  236. int len = list.numChildren;
  237. list.ScrollToView(len - 1);
  238. for (int i = 0; i < len; i++)
  239. {
  240. UI_TypeItem item = UI_TypeItem.Proxy(list.GetChildAt(i));
  241. if (item != null)
  242. {
  243. int menuID = (int)item.target.data;
  244. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  245. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  246. {
  247. ShowGuide(item.target, true, "点击套装分类,可查看收集的套装");
  248. return true;
  249. }
  250. }
  251. }
  252. }
  253. return false;
  254. }
  255. public static void TryGuideDressUpViewMenuPart(GList list)
  256. {
  257. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  258. {
  259. if (list.numChildren > 0)
  260. {
  261. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  262. if (listItem != null)
  263. {
  264. ShowGuide(listItem.target, true, "点击图标,可换上整套衣服");
  265. return;
  266. }
  267. }
  268. }
  269. }
  270. /*******************************************************************************************************************/
  271. public static bool TryGuideByGuideId(GObject target, int guideId, int maxCount = 1, bool needUpdate = false, string guideStr = null, int yTxt = 0, int preGuideIdAtThisLogin = 0)
  272. {
  273. if (preGuideIdAtThisLogin > 0 && !GuideDataManager.CheckGuideIsCompletedAtThisLogin(preGuideIdAtThisLogin))
  274. {
  275. return false;
  276. }
  277. if (GuideDataManager.GetGuideCount(guideId) < maxCount)
  278. {
  279. GuideDataManager.currentGuideId = guideId;
  280. ShowGuide(target, needUpdate, guideStr, yTxt);
  281. return true;
  282. }
  283. return false;
  284. }
  285. public static bool TryCompleteGuide(int guideId)
  286. {
  287. bool result = GuideDataManager.TryCompleteGuide(guideId);
  288. if (result)
  289. {
  290. HideGuide();
  291. }
  292. return result;
  293. }
  294. public static void HideGuide()
  295. {
  296. ViewManager.Hide(ViewName.GUIDE_VIEW);
  297. }
  298. private static void ShowGuide(GObject target, bool needUpdate = false, string guideStr = null, int yTxt = 0, float devWidth = 0, float devHeight = 0)
  299. {
  300. HideGuide();
  301. if (GameGlobal.skipGuide)
  302. {
  303. return;
  304. }
  305. ViewManager.Show(ViewName.GUIDE_VIEW, new List<object> { target, needUpdate, guideStr, yTxt, devWidth, devHeight });
  306. }
  307. }
  308. }