GuideController.cs 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  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 TryGuideDressUpFightViewBtnRecommend(GObject target)
  85. {
  86. if (GuideDataManager.GetGuideCount(ConstGuideId.CHAPTER_VIEW_BTN_HOME) <= 0
  87. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel)
  88. && DressUpMenuItemDataManager.GetRecommendCount() >= 2)
  89. {
  90. ShowGuide(target, false, "点击推荐搭配, 可快速换上目标属性最高的服装");
  91. }
  92. }
  93. public static void TryGuideDressUpFightViewBtnNext(GObject target)
  94. {
  95. if (GuideDataManager.GetGuideCount(ConstGuideId.CHAPTER_VIEW_BTN_HOME) <= 0
  96. && !StoryDataManager.CheckLevelPass(StoryDataManager.currentChapter, StoryDataManager.currentLevel)
  97. && EquipDataCache.cacher.CheckCurrentScoreEnough()
  98. && EquipDataCache.cacher.CheckEquipedFightNeeded())
  99. {
  100. ShowGuide(target, false, "服装搭配好后,点击下一步,看看战果如何");
  101. }
  102. }
  103. public static bool TryGuideDressUpViewMenuType1(GList list)
  104. {
  105. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  106. {
  107. int len = list.numChildren;
  108. list.ScrollToView(len - 1);
  109. for (int i = 0; i < len; i++)
  110. {
  111. UI_TypeItem item = UI_TypeItem.Proxy(list.GetChildAt(i));
  112. if (item != null)
  113. {
  114. int menuID = (int)item.target.data;
  115. DressUpMenuItemCfg1 dressUpMenuItemCfg1 = DressUpMenuItemCfg1Array.Instance.GetCfg(menuID);
  116. if (dressUpMenuItemCfg1.type == ConstDressUpItemType.TAO_ZHUANG)
  117. {
  118. ShowGuide(item.target, true, "点击套装分类,可查看收集的套装");
  119. return true;
  120. }
  121. }
  122. }
  123. }
  124. return false;
  125. }
  126. public static void TryGuideDressUpViewMenuPart(GList list)
  127. {
  128. if (GuideDataManager.currentGuideId == ConstGuideId.MAIN_UI_BTN_HUAN_ZHUANG)
  129. {
  130. if (list.numChildren > 0)
  131. {
  132. UI_PartsListItem listItem = UI_PartsListItem.Proxy(list.GetChildAt(0));
  133. if (listItem != null)
  134. {
  135. ShowGuide(listItem.target, true, "点击图标,可换上整套衣服");
  136. return;
  137. }
  138. }
  139. }
  140. }
  141. public static bool TryGuideByGuideId(GObject target, int guideId, int maxCount = 1, bool needUpdate = false, string guideStr = null, int yTxt = 0, int preGuideIdAtThisLogin = 0)
  142. {
  143. if (preGuideIdAtThisLogin > 0 && !GuideDataManager.CheckGuideIsCompletedAtThisLogin(preGuideIdAtThisLogin))
  144. {
  145. return false;
  146. }
  147. if (GuideDataManager.GetGuideCount(guideId) < maxCount)
  148. {
  149. GuideDataManager.currentGuideId = guideId;
  150. ShowGuide(target, needUpdate, guideStr, yTxt);
  151. return true;
  152. }
  153. return false;
  154. }
  155. public static bool TryCompleteGuide(int guideId)
  156. {
  157. bool result = GuideDataManager.TryCompleteGuide(guideId);
  158. if (result)
  159. {
  160. HideGuide();
  161. }
  162. return result;
  163. }
  164. public static void HideGuide()
  165. {
  166. ViewManager.Hide(ViewName.GUIDE_VIEW);
  167. }
  168. private static void ShowGuide(GObject target, bool needUpdate = false, string guideStr = null, int yTxt = 0)
  169. {
  170. HideGuide();
  171. if (GameGlobal.skipGuide)
  172. {
  173. return;
  174. }
  175. ViewManager.Show(ViewName.GUIDE_VIEW, new List<object> { target, needUpdate, guideStr, yTxt });
  176. }
  177. }
  178. }