StoryController.cs 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. return;
  43. }
  44. else
  45. {
  46. ViewManager.Show<StoryChapterListView>(new object[] { index, nextStoryChapterCfg.order }, true);
  47. }
  48. }
  49. else
  50. {
  51. ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId);
  52. }
  53. }
  54. else
  55. {
  56. //异常返回到关卡列表界面
  57. ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId);
  58. }
  59. }
  60. public static bool CheckSuitGot(int suitID = 0)
  61. {
  62. if(suitID == 0)
  63. {
  64. return true;
  65. }
  66. int count;
  67. int totalCount;
  68. DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitID, out count, out totalCount);
  69. if(count >= totalCount)
  70. {
  71. return true;
  72. }
  73. return false;
  74. }
  75. public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData)
  76. {
  77. ViewManager.Show<StoryDialogView>(new object[] { cardStoryCfg.storyStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData ,false}, true);
  78. }
  79. private static void OnCompleteCardStoryDialog(bool isSkip, object param)
  80. {
  81. //CardData cardData = param as CardData;
  82. //ViewManager.Show<CardFosterView>(cardData, new object[] { typeof(CardDetailView).FullName}, true);
  83. //ViewManager.Show<CardStoryView>(cardData);
  84. }
  85. public static void ShowPriorStoryDialog()
  86. {
  87. InstanceZonesDataManager.currentLevelCfgId = 100001001;
  88. string stroyStartID = "1";
  89. // string stroyStartID = MainStoryDataManager.priorId;
  90. ViewManager.Show<StoryDialogView>(new object[] { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog),null,false }, true);
  91. }
  92. private static void OnCompletePriorStoryDialog(bool isSkip, object param)
  93. {
  94. //ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(typeof(StoryChapterView).FullName), true);
  95. }
  96. public static void ShowFilingStoryDialog(StoryLevelCfg storyLevelCfg)
  97. {
  98. InstanceZonesDataManager.currentLevelCfgId = storyLevelCfg.id;
  99. ViewManager.Show<StoryDialogView>(new object[] { storyLevelCfg.storyStartID, false, new OnCompleteStoryDialogCall(OnCompleteFilingStoryDialog) ,null,false}, true);
  100. }
  101. private static void OnCompleteFilingStoryDialog(bool isSkip, object param)
  102. {
  103. //InstanceZonesController.OnCompleteChapterStoryDialog(isSkip, param);
  104. //ViewManager.Show<StudioFilingView>(MainStoryDataManager.currentChapterCfgId, null, true);
  105. //, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName)
  106. }
  107. }
  108. }