StoryController.cs 4.4 KB

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