using ET; using System.Collections.Generic; namespace GFGGame { public class StoryController { public static void ShowLevelView(int chapterID, int level) { int levelID = chapterID*GameConst.STORY_LEVEL_KEY_NUM + level; StoryDataManager.currentChapter = chapterID; StoryDataManager.currentLevelCfgId = 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.currentLevelCfgId = 1001; ViewManager.Show(ViewName.STORY_DIALOG_VIEW, new object[] { StoryDataManager.priorId, false, new OnCompleteStoryDialogCall(OnCompleteChapterStoryDialog) }, null, true); } public static async ETTask CheckStoryFightResult() { var score = EquipDataCache.cacher.totalScore; //客户端先做判断,成功和失败处理不同 var success = StoryDataManager.GetFightResult(score, out var npcScore); if(success) { await StorySProxy.FinishStoryFightLevel(StoryDataManager.currentLevelCfgId, score, npcScore, StoryDataManager.usedRecommend); } else { ViewManager.Show(ViewName.STORY_FIGHT_RESULT_VIEW, new StoryFightResultData { Result = false, Score = score, FirstPass = false, Star = 0 }, null, true); //失败仅判断并更新最高分 if(score > StoryDataManager.GetScoreHighest(StoryDataManager.currentCardId)) { StorySProxy.FinishStoryFightLevelFail(StoryDataManager.currentLevelCfgId, score).Coroutine(); } } } private static void OnCompleteChapterStoryDialog(bool isSkip, object param) { //List bonusList = null; bool _fistPassLastLvl = false; bool _curLvfirstPass = false; if (!StoryDataManager.CheckCurrentLevelPass()) { //bonusList = StoryDataManager.PassCurrentLevel(out _fistPassLastLvl, out _curLvfirstPass); StorySProxy.FinishStoryDialogLevel(StoryDataManager.currentLevelCfgId).Coroutine(); } 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(GameGlobal.myNumericComponent.GetAsInt(NumericType.Chapter) + 1, GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterLvl));//首次通过要检查是否有功能开启 } //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); } } }