StoryController.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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. private static void OnCompleteChapterStoryDialog(bool isSkip, object param)
  28. {
  29. List<ItemData> bonusList = null;
  30. bool _fistPassLastLvl = false;
  31. if (!isSkip)
  32. {
  33. bonusList = StoryDataManager.PassCurrentLevel(out _fistPassLastLvl);
  34. }
  35. if (_fistPassLastLvl)
  36. {
  37. ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW, null, null, true);
  38. }
  39. else
  40. {
  41. ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, null, true);
  42. }
  43. if (bonusList != null && bonusList.Count > 0)
  44. {
  45. ViewManager.Show(ViewName.GET_BONUS_VIEW, bonusList);
  46. }
  47. }
  48. private static void OnCompleteCardStoryDialog(bool isSkip, object param)
  49. {
  50. CardData cardData = param as CardData;
  51. ViewManager.Show(ViewName.CARD_FOSTER_VIEW, cardData, new object[] { ViewName.CARD_DETAIL_VIEW}, true);
  52. ViewManager.Show(ViewName.CARD_STORY_VIEW, cardData);
  53. }
  54. }
  55. }