StoryController.cs 4.4 KB

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