12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System.Collections.Generic;
- namespace GFGGame
- {
- public class StoryController
- {
- public static void ShowLevelView(int chapterID, int level)
- {
- string levelID = chapterID + "_" + level;
- StoryDataManager.currentChapter = chapterID;
- StoryDataManager.currentLevelID = levelID;
- StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelID);
- StoryDataManager.currentLevel = level;
- if (levelCfg.fightID.Length > 0)
- {
- ViewManager.Show(ViewName.STORY_LEVEL_INFO_VIEW, levelID);
- }
- else if (levelCfg.storyStartID.Length > 0)
- {
- bool skipable = StoryDataManager.CheckCurrentLevelPass();
- ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { levelCfg.storyStartID, skipable, new OnCompleteStoryDialogCall(OnCompleteChapterStoryDialog) }, null, true);
- }
- }
- public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData)
- {
- ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { cardStoryCfg.storyStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData }, null, true);
- }
- public static void ShowPriorStoryDialog()
- {
- StoryDataManager.currentChapter = 1;
- StoryDataManager.currentLevelID = "1_1";
- ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { StoryDataManager.priorId, false, new OnCompleteStoryDialogCall(OnCompleteChapterStoryDialog) }, null, true);
- }
- private static void OnCompleteChapterStoryDialog(bool isSkip, object param)
- {
- List<ItemData> bonusList = null;
- bool _fistPassLastLvl = false;
- bool _curLvfirstPass = false;
- if (!StoryDataManager.CheckCurrentLevelPass())
- {
- bonusList = StoryDataManager.PassCurrentLevel(out _fistPassLastLvl, out _curLvfirstPass);
- }
- if (_fistPassLastLvl)
- {
- ViewManager.Show(ViewName.STORY_CHAPTER_LIST_VIEW, null, null, true);
- }
- else
- {
- ViewManager.Show(ViewName.STORY_CHAPTER_VIEW, StoryDataManager.currentChapter, ViewManager.GetGoBackDatas(ViewName.STORY_CHAPTER_VIEW), true);
- }
- if (_curLvfirstPass)
- {
- FunctionOpenDataManager.Instance.CheckHasChapterFunOpen(StoryDataManager._passChapter + 1, StoryDataManager._passLevel);//首次通过要检查是否有功能开启
- }
- if (bonusList != null && bonusList.Count > 0)
- {
- ViewManager.Show(ViewName.GET_BONUS_VIEW, bonusList);
- }
- }
- private static void OnCompleteCardStoryDialog(bool isSkip, object param)
- {
- CardData cardData = param as CardData;
- ViewManager.Show(ViewName.CARD_FOSTER_VIEW, cardData, new object[] { ViewName.CARD_DETAIL_VIEW }, true);
- ViewManager.Show(ViewName.CARD_STORY_VIEW, cardData);
- }
- }
- }
|