GuideController.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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. && DressUpMenuItemDataManager.GetRecommendCount() >= 2)
  146. {
  147. ShowGuide(target, false, "点击购买");
  148. }
  149. }
  150. public static void TryGuideClothingShopViewBtnBack(GObject target)
  151. {
  152. if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0
  153. && StoryDataManager.currentLevel == 4
  154. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel)
  155. && DressUpMenuItemDataManager.GetRecommendCount() >= 2)
  156. {
  157. ShowGuide(target, false, "点击返回,继续搭配衣服");
  158. }
  159. }
  160. private static GList _list;
  161. public static bool TryGuideDressUpFightViewMenuType1()
  162. {
  163. if (GuideDataManager.GetGuideCount(ConstGuideId.CLOTHING_SHOP_VIEW_BTN_BUY) <= 0
  164. && StoryDataManager.currentLevel == 4
  165. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel)
  166. && DressUpMenuItemDataManager.GetRecommendCount() >= 2)
  167. {
  168. int len = _list.numChildren;
  169. for (int i = 0; i < len; i++)
  170. {
  171. UI_TypeItem item = UI_TypeItem.Proxy(_list.GetChildAt(i));
  172. if (item != null)
  173. {
  174. int menuID = (int)item.target.data;
  175. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  176. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.LIAN_YI_QUN)
  177. {
  178. ShowGuide(item.target, true, "点击必需品图标");
  179. _list = null;
  180. return true;
  181. }
  182. }
  183. }
  184. }
  185. return false;
  186. }
  187. public static void TryGuideDressUpFightViewMenuPart1(GList list, string guideStr)
  188. {
  189. if (StoryDataManager.currentChapter == 1 && StoryDataManager.currentLevel == 4
  190. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  191. {
  192. if (list.numChildren > 0)
  193. {
  194. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  195. if (listItem != null)
  196. {
  197. ShowGuide(listItem.target, true, guideStr);
  198. return;
  199. }
  200. }
  201. }
  202. }
  203. // public static void TryGuideDressUpFightViewMenuPart(GList list)
  204. // {
  205. // if (list.numChildren > 0)
  206. // {
  207. // UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  208. // if (listItem != null)
  209. // {
  210. // ShowGuide(listItem.target, true, "点击");
  211. // return;
  212. // }
  213. // }
  214. // }
  215. public static bool TryGuideDressUpViewMenuType1(GList list)
  216. {
  217. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  218. {
  219. int len = list.numChildren;
  220. list.ScrollToView(len - 1);
  221. for (int i = 0; i < len; i++)
  222. {
  223. UI_TypeItem item = UI_TypeItem.Proxy(list.GetChildAt(i));
  224. if (item != null)
  225. {
  226. int menuID = (int)item.target.data;
  227. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  228. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  229. {
  230. ShowGuide(item.target, true, "点击套装分类,可查看收集的套装");
  231. return true;
  232. }
  233. }
  234. }
  235. }
  236. return false;
  237. }
  238. public static void TryGuideDressUpViewMenuPart(GList list)
  239. {
  240. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  241. {
  242. if (list.numChildren > 0)
  243. {
  244. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  245. if (listItem != null)
  246. {
  247. ShowGuide(listItem.target, true, "点击图标,可换上整套衣服");
  248. return;
  249. }
  250. }
  251. }
  252. }
  253. /**************************************************引导购买必需品****************************************************/
  254. /*******************************************************************************************************************/
  255. public static bool TryGuideByGuideId(GObject target, int guideId, int maxCount = 1, bool needUpdate = false, string guideStr = null, int yTxt = 0, int preGuideIdAtThisLogin = 0)
  256. {
  257. if (preGuideIdAtThisLogin > 0 && !GuideDataManager.CheckGuideIsCompletedAtThisLogin(preGuideIdAtThisLogin))
  258. {
  259. return false;
  260. }
  261. if (GuideDataManager.GetGuideCount(guideId) < maxCount)
  262. {
  263. GuideDataManager.currentGuideId = guideId;
  264. ShowGuide(target, needUpdate, guideStr, yTxt);
  265. return true;
  266. }
  267. return false;
  268. }
  269. public static bool TryCompleteGuide(int guideId)
  270. {
  271. bool result = GuideDataManager.TryCompleteGuide(guideId);
  272. if (result)
  273. {
  274. HideGuide();
  275. }
  276. return result;
  277. }
  278. public static void HideGuide()
  279. {
  280. ViewManager.Hide(ViewName.GUIDE_VIEW);
  281. }
  282. private static void ShowGuide(GObject target, bool needUpdate = false, string guideStr = null, int yTxt = 0)
  283. {
  284. HideGuide();
  285. if (GameGlobal.skipGuide)
  286. {
  287. return;
  288. }
  289. ViewManager.Show(ViewName.GUIDE_VIEW, new List<object> { target, needUpdate, guideStr, yTxt });
  290. }
  291. }
  292. }