StoryController.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. using System.Collections;
  4. using System.Linq;
  5. using cfg.GfgCfg;
  6. using ET;
  7. namespace GFGGame
  8. {
  9. //主线剧情专用类
  10. public class StoryController
  11. {
  12. public static void ShowLevelView(int levelCfgId, int needitemId = 0, int needItemCount = 0)
  13. {
  14. InstanceZonesController.ShowLevelView(levelCfgId, OnFinishStoryLevel, needitemId, needItemCount);
  15. }
  16. public static void OnFinishStoryLevel(int levelCfgId, bool firstPass, bool success)
  17. {
  18. if (success)
  19. {
  20. //判断是否是首次打通最后一关
  21. int nextLevelID = levelCfgId + 1;
  22. StoryLevelCfg nextLevelCfg = CommonDataManager.Tables.TblStoryLevelCfg.GetOrDefault(nextLevelID);
  23. var fistPassLastLvl = (nextLevelCfg == null) && firstPass;
  24. if (fistPassLastLvl)
  25. {
  26. MainStorySProxy.GetStoryBonusDate().Coroutine();
  27. StoryLevelCfg levelCfg = CommonDataManager.Tables.TblStoryLevelCfg.GetOrDefault(levelCfgId);
  28. StoryChapterCfg nextStoryChapterCfg =
  29. CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId + 1);
  30. if (nextStoryChapterCfg != null)
  31. {
  32. StoryLevelCfg nextChapterLevelCfg = CommonDataManager.Tables.TblStoryLevelCfg.DataList
  33. .Where(a => a.Type == nextStoryChapterCfg.Type &&
  34. a.SubType == nextStoryChapterCfg.SubType &&
  35. a.ChapterId == nextStoryChapterCfg.Id)
  36. .ToList()[0];
  37. int LevelID = nextChapterLevelCfg.Id;
  38. MainStoryDataManager.currentLevelCfgId = LevelID;
  39. }
  40. else
  41. {
  42. MainStoryDataManager.currentLevelCfgId = 0;
  43. }
  44. int index = 0;
  45. if (levelCfg.Type == ConstInstanceZonesType.Story &&
  46. levelCfg.SubType == ConstInstanceZonesSubType.Hard)
  47. {
  48. index = 1;
  49. }
  50. //当副本表内最后一章通关时
  51. if (nextStoryChapterCfg == null)
  52. {
  53. StoryChapterCfg lastChapter =
  54. CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId);
  55. ViewManager.Show<StoryChapterListView>(new object[] { index, lastChapter.Order }, true);
  56. return;
  57. }
  58. else
  59. {
  60. //ViewManager.Show<StoryChapterListView>(new object[] { index, nextStoryChapterCfg.order }, true);
  61. StoryChapterCfg previousChapterCfg =
  62. CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId);
  63. StoryChapterCfg nextChapterCfg =
  64. CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId + 1);
  65. bool lv = nextChapterCfg.Lvl < GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);
  66. if (CheckSuitGot(previousChapterCfg.SuitId) &&
  67. MainStoryDataManager.CheckChapterUnlock(levelCfg.ChapterId) && lv)
  68. {
  69. ViewManager.Show<StoryChapterListView>(new object[] { index, nextStoryChapterCfg.Order },
  70. true);
  71. }
  72. else
  73. {
  74. //MainStoryDataManager.currentChapterCfgId = previousChapterCfg.id;
  75. ViewManager.Show<StoryChapterView>(new object[] { previousChapterCfg.Id, 0 }, true);
  76. }
  77. }
  78. }
  79. else
  80. {
  81. ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId);
  82. }
  83. }
  84. else
  85. {
  86. //异常返回到关卡列表界面
  87. ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId);
  88. }
  89. }
  90. public static bool CheckSuitGot(int suitID = 0)
  91. {
  92. if (suitID == 0)
  93. {
  94. return true;
  95. }
  96. int count;
  97. int totalCount;
  98. DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitID, out count, out totalCount);
  99. if (count >= totalCount)
  100. {
  101. return true;
  102. }
  103. return false;
  104. }
  105. public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData)
  106. {
  107. ViewManager.Show<StoryDialogView>(
  108. new object[]
  109. {
  110. cardStoryCfg.StoryStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData,
  111. false
  112. }, true);
  113. }
  114. private static void OnCompleteCardStoryDialog(bool isSkip, object param)
  115. {
  116. //CardData cardData = param as CardData;
  117. //ViewManager.Show<CardFosterView>(cardData, new object[] { typeof(CardDetailView).FullName}, true);
  118. //ViewManager.Show<CardStoryView>(cardData);
  119. }
  120. public static void ShowPriorStoryDialog()
  121. {
  122. InstanceZonesDataManager.currentLevelCfgId = 100001001;
  123. string stroyStartID = "1";
  124. // string stroyStartID = MainStoryDataManager.priorId;
  125. ViewManager.Show<StoryDialogView>(
  126. new object[]
  127. { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog), null, false },
  128. true);
  129. }
  130. private static void OnCompletePriorStoryDialog(bool done, object param)
  131. {
  132. //ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(typeof(StoryChapterView).FullName), true);
  133. }
  134. public static void ShowFilingStoryDialog(StoryLevelCfg storyLevelCfg)
  135. {
  136. InstanceZonesDataManager.currentLevelCfgId = storyLevelCfg.Id;
  137. ViewManager.Show<StoryDialogView>(
  138. new object[]
  139. {
  140. storyLevelCfg.StoryStartID, false, new OnCompleteStoryDialogCall(OnCompleteFilingStoryDialog), null,
  141. false
  142. }, true);
  143. }
  144. private static void OnCompleteFilingStoryDialog(bool isSkip, object param)
  145. {
  146. //InstanceZonesController.OnCompleteChapterStoryDialog(isSkip, param);
  147. //ViewManager.Show<StudioFilingView>(MainStoryDataManager.currentChapterCfgId, null, true);
  148. //, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName)
  149. }
  150. }
  151. }