StoryController.cs 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. namespace GFGGame
  2. {
  3. //主线剧情专用类
  4. public class StoryController
  5. {
  6. public static void ShowLevelView(int levelCfgId)
  7. {
  8. InstanceZonesController.ShowLevelView(levelCfgId, OnFinishStoryLevel);
  9. }
  10. public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData)
  11. {
  12. ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { cardStoryCfg.storyStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData }, null, true);
  13. }
  14. public static void ShowPriorStoryDialog()
  15. {
  16. InstanceZonesDataManager.currentLevelCfgId = 100001001;
  17. ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { MainStoryDataManager.priorId, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog) }, null, true);
  18. }
  19. public static void OnFinishStoryLevel(int levelCfgId, bool firstPass, bool success)
  20. {
  21. if (success)
  22. {
  23. //判断是否是首次打通最后一关
  24. int nextLevelID = levelCfgId + 1;
  25. StoryLevelCfg nextLevelCfg = StoryLevelCfgArray.Instance.GetCfg(nextLevelID);
  26. var fistPassLastLvl = (nextLevelCfg == null) && firstPass;
  27. if (fistPassLastLvl)
  28. {
  29. StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
  30. StoryChapterCfg nextStoryChapterCfg = StoryChapterCfgArray.Instance.GetCfg(levelCfg.chapterId + 1);
  31. if (nextStoryChapterCfg != null)
  32. {
  33. StoryLevelCfg nextChapterLevelCfg = StoryLevelCfgArray.Instance.GetCfgs(nextStoryChapterCfg.type, nextStoryChapterCfg.subType, nextStoryChapterCfg.id)[0];
  34. int LevelID = nextChapterLevelCfg.id;
  35. MainStoryDataManager.currentLevelCfgId = LevelID;
  36. }
  37. else
  38. {
  39. MainStoryDataManager.currentLevelCfgId = 0;
  40. }
  41. ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW, null, null, true);
  42. }
  43. else
  44. {
  45. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW), true);
  46. }
  47. }
  48. else
  49. {
  50. //异常返回到关卡列表界面
  51. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW), true);
  52. }
  53. }
  54. private static void OnCompleteCardStoryDialog(bool isSkip, object param)
  55. {
  56. CardData cardData = param as CardData;
  57. ViewManager.Show(ViewName.CARD_FOSTER_VIEW, cardData, new object[] { ViewName.CARD_DETAIL_VIEW }, true);
  58. ViewManager.Show(ViewName.CARD_STORY_VIEW, cardData);
  59. }
  60. private static void OnCompletePriorStoryDialog(bool isSkip, object param)
  61. {
  62. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW), true);
  63. }
  64. }
  65. }