StoryController.cs 2.6 KB

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