StoryController.cs 3.2 KB

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