StoryController.cs 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW, null, null, true);
  33. }
  34. else
  35. {
  36. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW), true);
  37. }
  38. }
  39. else
  40. {
  41. //异常返回到关卡列表界面
  42. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW), true);
  43. }
  44. }
  45. public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData)
  46. {
  47. ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { cardStoryCfg.storyStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData }, null, true);
  48. }
  49. private static void OnCompleteCardStoryDialog(bool isSkip, object param)
  50. {
  51. CardData cardData = param as CardData;
  52. ViewManager.Show(ViewName.CARD_FOSTER_VIEW, cardData, new object[] { ViewName.CARD_DETAIL_VIEW }, true);
  53. ViewManager.Show(ViewName.CARD_STORY_VIEW, cardData);
  54. }
  55. public static void ShowPriorStoryDialog()
  56. {
  57. InstanceZonesDataManager.currentLevelCfgId = 100001001;
  58. string stroyStartID = "1";
  59. // string stroyStartID = MainStoryDataManager.priorId;
  60. ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog) }, null, true);
  61. }
  62. private static void OnCompletePriorStoryDialog(bool isSkip, object param)
  63. {
  64. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW), true);
  65. }
  66. public static void ShowFilingStoryDialog(StoryLevelCfg storyLevelCfg)
  67. {
  68. InstanceZonesDataManager.currentLevelCfgId = storyLevelCfg.id;
  69. ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { storyLevelCfg.storyStartID, false, new OnCompleteStoryDialogCall(OnCompleteFilingStoryDialog) }, null, true);
  70. }
  71. private static void OnCompleteFilingStoryDialog(bool isSkip, object param)
  72. {
  73. InstanceZonesController.OnCompleteChapterStoryDialog(isSkip, param);
  74. ViewManager.Show<StudioFilingView>(MainStoryDataManager.currentChapterCfgId, null, true);
  75. //, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName)
  76. }
  77. }
  78. }