StoryController.cs 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. namespace GFGGame
  2. {
  3. //主线剧情专用类
  4. public class StoryController
  5. {
  6. public static void ShowLevelView(int levelCfgId, int needitemId = 0, int needItemCount = 0)
  7. {
  8. InstanceZonesController.ShowLevelView(levelCfgId, OnFinishStoryLevel, needitemId, needItemCount);
  9. }
  10. public static void OnFinishStoryLevel(int levelCfgId, bool firstPass, bool success)
  11. {
  12. if (success)
  13. {
  14. //判断是否是首次打通最后一关
  15. int nextLevelID = levelCfgId + 1;
  16. StoryLevelCfg nextLevelCfg = StoryLevelCfgArray.Instance.GetCfg(nextLevelID);
  17. var fistPassLastLvl = (nextLevelCfg == null) && firstPass;
  18. if (fistPassLastLvl)
  19. {
  20. StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
  21. StoryChapterCfg nextStoryChapterCfg = StoryChapterCfgArray.Instance.GetCfg(levelCfg.chapterId + 1);
  22. if (nextStoryChapterCfg != null)
  23. {
  24. StoryLevelCfg nextChapterLevelCfg = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(nextStoryChapterCfg.type, nextStoryChapterCfg.subType, nextStoryChapterCfg.id)[0];
  25. int LevelID = nextChapterLevelCfg.id;
  26. MainStoryDataManager.currentLevelCfgId = LevelID;
  27. }
  28. else
  29. {
  30. MainStoryDataManager.currentLevelCfgId = 0;
  31. }
  32. int index = 0;
  33. if (levelCfg.type == ConstInstanceZonesType.Story && levelCfg.subType == ConstInstanceZonesSubType.Hard)
  34. {
  35. index = 1;
  36. }
  37. //当副本表内最后一章通关时
  38. if (nextStoryChapterCfg == null)
  39. {
  40. StoryChapterCfg lastChapter = StoryChapterCfgArray.Instance.GetCfg(levelCfg.chapterId);
  41. ViewManager.Show<StoryChapterListView>(new object[] { index, lastChapter.order }, true);
  42. }
  43. else
  44. {
  45. StoryChapterCfg previousChapterCfg = StoryChapterCfgArray.Instance.GetCfg(levelCfg.chapterId);
  46. if(CheckSuitGot(previousChapterCfg.suitId))
  47. {
  48. ViewManager.Show<StoryChapterView>(new object[] { previousChapterCfg.id, 0}, true);
  49. }
  50. else
  51. {
  52. ViewManager.Show<StoryChapterListView>(new object[] { index, nextStoryChapterCfg.order }, true);
  53. }
  54. }
  55. }
  56. else
  57. {
  58. ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId);
  59. }
  60. }
  61. else
  62. {
  63. //异常返回到关卡列表界面
  64. ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId);
  65. }
  66. }
  67. public static bool CheckSuitGot(int suitID = 0)
  68. {
  69. if(suitID == 0)
  70. {
  71. return true;
  72. }
  73. int count;
  74. int totalCount;
  75. DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitID, out count, out totalCount);
  76. if(count >= totalCount)
  77. {
  78. return true;
  79. }
  80. return false;
  81. }
  82. public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData)
  83. {
  84. ViewManager.Show<StoryDialogView>(new object[] { cardStoryCfg.storyStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData ,false}, true);
  85. }
  86. private static void OnCompleteCardStoryDialog(bool isSkip, object param)
  87. {
  88. //CardData cardData = param as CardData;
  89. //ViewManager.Show<CardFosterView>(cardData, new object[] { typeof(CardDetailView).FullName}, true);
  90. //ViewManager.Show<CardStoryView>(cardData);
  91. }
  92. public static void ShowPriorStoryDialog()
  93. {
  94. InstanceZonesDataManager.currentLevelCfgId = 100001001;
  95. string stroyStartID = "1";
  96. // string stroyStartID = MainStoryDataManager.priorId;
  97. ViewManager.Show<StoryDialogView>(new object[] { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog),null,false }, true);
  98. }
  99. private static void OnCompletePriorStoryDialog(bool isSkip, object param)
  100. {
  101. //ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(typeof(StoryChapterView).FullName), true);
  102. }
  103. public static void ShowFilingStoryDialog(StoryLevelCfg storyLevelCfg)
  104. {
  105. InstanceZonesDataManager.currentLevelCfgId = storyLevelCfg.id;
  106. ViewManager.Show<StoryDialogView>(new object[] { storyLevelCfg.storyStartID, false, new OnCompleteStoryDialogCall(OnCompleteFilingStoryDialog) ,null,false}, true);
  107. }
  108. private static void OnCompleteFilingStoryDialog(bool isSkip, object param)
  109. {
  110. //InstanceZonesController.OnCompleteChapterStoryDialog(isSkip, param);
  111. //ViewManager.Show<StudioFilingView>(MainStoryDataManager.currentChapterCfgId, null, true);
  112. //, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName)
  113. }
  114. }
  115. }