GuideController.cs 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. using FairyGUI;
  2. using UI.DressUp;
  3. using UI.Main;
  4. using System.Collections.Generic;
  5. namespace GFGGame
  6. {
  7. public class GuideController
  8. {
  9. public static void TryGuideChapterViewLevelItem(GObject target, string guideStr = null)
  10. {
  11. if (GuideDataManager.GetGuideCount(ConstGuideId.CHAPTER_VIEW_BTN_HOME) <= 0)
  12. {
  13. if (guideStr == null)
  14. {
  15. UI_CompStoryLevelItem levelItem = UI_CompStoryLevelItem.Proxy(target);
  16. if (levelItem != null)
  17. {
  18. int level = int.Parse(levelItem.target.name.Replace("g", ""));
  19. string levelID = StoryDataManager.currentChapter + "_" + level;
  20. StoryLevelCfg storyLevelCfg = StoryLevelCfgArray.Instance.GetCfg(levelID);
  21. if (storyLevelCfg.fightID != null && storyLevelCfg.fightID.Length > 0)
  22. {
  23. guideStr = "点击关卡图标,继续挑战";
  24. }
  25. else
  26. {
  27. guideStr = "点击关卡图标,继续故事";
  28. }
  29. }
  30. else
  31. {
  32. guideStr = "点击,继续";
  33. }
  34. }
  35. ShowGuide(target, true, guideStr);
  36. }
  37. }
  38. public static void TryGuideChapterInfoViewBtnStart(GObject target, string guideStr = null)
  39. {
  40. if (GuideDataManager.GetGuideCount(ConstGuideId.CHAPTER_VIEW_BTN_HOME) <= 0)
  41. {
  42. if (guideStr == null)
  43. {
  44. guideStr = "点击,继续";
  45. }
  46. ShowGuide(target, true, guideStr);
  47. }
  48. }
  49. public static bool TryGuideDressUpFightViewMenuType1(GList list)
  50. {
  51. if (StoryDataManager.currentChapter == 1 && StoryDataManager.currentLevel <= 2
  52. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel))
  53. {
  54. int len = list.numChildren;
  55. for (int i = 0; i < len; i++)
  56. {
  57. UI_TypeItem item = UI_TypeItem.Proxy(list.GetChildAt(i));
  58. if (item != null)
  59. {
  60. int menuID = (int)item.target.data;
  61. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  62. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.LIAN_YI_QUN)
  63. {
  64. ShowGuide(item.target, true, "点击分类图标,可查看对应类型的服装");
  65. return true;
  66. }
  67. }
  68. }
  69. }
  70. return false;
  71. }
  72. public static void TryGuideDressUpFightViewMenuPart(GList list)
  73. {
  74. if (list.numChildren > 0)
  75. {
  76. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  77. if (listItem != null)
  78. {
  79. ShowGuide(listItem.target, true, "点击图标,换上新衣服吧");
  80. return;
  81. }
  82. }
  83. }
  84. public static void TryGuideDressUpFightViewBtnNext0(GObject target)
  85. {
  86. if (GuideDataManager.GetGuideCount(ConstGuideId.CHAPTER_VIEW_BTN_HOME) <= 0)
  87. {
  88. ShowGuide(target, false, "换好衣服后,点击下一步进行战斗");
  89. }
  90. }
  91. public static void TryGuideSingleScoreViewComClickCircle(GObject target)
  92. {
  93. // if (GuideDataManager.GetGuideCount(ConstGuideId.CHAPTER_VIEW_BTN_HOME) <= 0)
  94. // {
  95. ShowGuide(target, false, "点击圆圈进行部件评分,精准率越高,部件额外加分越高哦");
  96. // }
  97. }
  98. public static void TryGuideDressUpFightViewBtnRecommend(GObject target)
  99. {
  100. if (GuideDataManager.GetGuideCount(ConstGuideId.CHAPTER_VIEW_BTN_HOME) <= 0
  101. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel)
  102. && DressUpMenuItemDataManager.GetRecommendCount() >= 2)
  103. {
  104. ShowGuide(target, false, "点击推荐搭配, 可快速换上目标属性最高的服装");
  105. }
  106. }
  107. public static void TryGuideDressUpFightViewBtnNext(GObject target)
  108. {
  109. if (GuideDataManager.GetGuideCount(ConstGuideId.CHAPTER_VIEW_BTN_HOME) <= 0
  110. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel)
  111. && EquipDataCache.cacher.CheckCurrentScoreEnough()
  112. && EquipDataCache.cacher.CheckEquipedFightNeeded())
  113. {
  114. ShowGuide(target, false, "服装搭配好后,点击下一步,看看战果如何");
  115. }
  116. }
  117. public static bool TryGuideDressUpViewMenuType1(GList list)
  118. {
  119. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  120. {
  121. int len = list.numChildren;
  122. list.ScrollToView(len - 1);
  123. for (int i = 0; i < len; i++)
  124. {
  125. UI_TypeItem item = UI_TypeItem.Proxy(list.GetChildAt(i));
  126. if (item != null)
  127. {
  128. int menuID = (int)item.target.data;
  129. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  130. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  131. {
  132. ShowGuide(item.target, true, "点击套装分类,可查看收集的套装");
  133. return true;
  134. }
  135. }
  136. }
  137. }
  138. return false;
  139. }
  140. public static void TryGuideDressUpViewMenuPart(GList list)
  141. {
  142. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  143. {
  144. if (list.numChildren > 0)
  145. {
  146. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  147. if (listItem != null)
  148. {
  149. ShowGuide(listItem.target, true, "点击图标,可换上整套衣服");
  150. return;
  151. }
  152. }
  153. }
  154. }
  155. /**************************************************引导购买必需品****************************************************/
  156. /*******************************************************************************************************************/
  157. public static bool TryGuideByGuideId(GObject target, int guideId, int maxCount = 1, bool needUpdate = false, string guideStr = null, int yTxt = 0, int preGuideIdAtThisLogin = 0)
  158. {
  159. if (preGuideIdAtThisLogin > 0 && !GuideDataManager.CheckGuideIsCompletedAtThisLogin(preGuideIdAtThisLogin))
  160. {
  161. return false;
  162. }
  163. if (GuideDataManager.GetGuideCount(guideId) < maxCount)
  164. {
  165. GuideDataManager.currentGuideId = guideId;
  166. ShowGuide(target, needUpdate, guideStr, yTxt);
  167. return true;
  168. }
  169. return false;
  170. }
  171. public static bool TryCompleteGuide(int guideId)
  172. {
  173. bool result = GuideDataManager.TryCompleteGuide(guideId);
  174. if (result)
  175. {
  176. HideGuide();
  177. }
  178. return result;
  179. }
  180. public static void HideGuide()
  181. {
  182. ViewManager.Hide(ViewName.GUIDE_VIEW);
  183. }
  184. private static void ShowGuide(GObject target, bool needUpdate = false, string guideStr = null, int yTxt = 0)
  185. {
  186. HideGuide();
  187. if (GameGlobal.skipGuide)
  188. {
  189. return;
  190. }
  191. ViewManager.Show(ViewName.GUIDE_VIEW, new List<object> { target, needUpdate, guideStr, yTxt });
  192. }
  193. }
  194. }