StoryController.cs 4.7 KB

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