StoryController.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using System.Collections.Generic;
  2. namespace GFGGame
  3. {
  4. public class StoryController
  5. {
  6. public static void ShowLevelView(int chapterID, int level)
  7. {
  8. string levelID = chapterID + "_" + level;
  9. StoryDataManager.currentChapter = chapterID;
  10. StoryDataManager.currentLevelID = levelID;
  11. StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelID);
  12. StoryDataManager.currentLevel = level;
  13. if (levelCfg.fightID.Length > 0)
  14. {
  15. ViewManager.Show(ViewName.STORY_LEVEL_INFO_VIEW, levelID);
  16. }
  17. else if (levelCfg.storyStartID.Length > 0)
  18. {
  19. bool skipable = StoryDataManager.CheckCurrentLevelPass();
  20. ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { levelCfg.storyStartID, skipable, new OnCompleteStoryDialogCall(OnCompleteChapterStoryDialog) }, null, true);
  21. }
  22. }
  23. public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData)
  24. {
  25. ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { cardStoryCfg.storyStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData }, null, true);
  26. }
  27. public static void ShowPriorStoryDialog()
  28. {
  29. StoryDataManager.currentChapter = 1;
  30. StoryDataManager.currentLevelID = "1_1";
  31. ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { StoryDataManager.priorId, false, new OnCompleteStoryDialogCall(OnCompleteChapterStoryDialog) }, null, true);
  32. }
  33. private static void OnCompleteChapterStoryDialog(bool isSkip, object param)
  34. {
  35. List<ItemData> bonusList = null;
  36. bool _fistPassLastLvl = false;
  37. bool _curLvfirstPass = false;
  38. if (!StoryDataManager.CheckCurrentLevelPass())
  39. {
  40. bonusList = StoryDataManager.PassCurrentLevel(out _fistPassLastLvl, out _curLvfirstPass);
  41. }
  42. if (_fistPassLastLvl)
  43. {
  44. ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW, null, null, true);
  45. }
  46. else
  47. {
  48. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW), true);
  49. }
  50. if (_curLvfirstPass)
  51. {
  52. FunctionOpenDataManager.Instance.CheckHasChapterFunOpen(StoryDataManager._passChapter + 1, StoryDataManager._passLevel);//首次通过要检查是否有功能开启
  53. }
  54. if (bonusList != null && bonusList.Count > 0)
  55. {
  56. ViewManager.Show(ViewName.GET_BONUS_VIEW, bonusList);
  57. }
  58. }
  59. private static void OnCompleteCardStoryDialog(bool isSkip, object param)
  60. {
  61. CardData cardData = param as CardData;
  62. ViewManager.Show(ViewName.CARD_FOSTER_VIEW, cardData, new object[] { ViewName.CARD_DETAIL_VIEW }, true);
  63. ViewManager.Show(ViewName.CARD_STORY_VIEW, cardData);
  64. }
  65. }
  66. }