using System.Collections.Generic; using UnityEngine; using System.Collections; using System.Linq; using cfg.GfgCfg; using ET; namespace GFGGame { //主线剧情专用类 public class StoryController { public static void ShowLevelView(int levelCfgId, int needitemId = 0, int needItemCount = 0) { InstanceZonesController.ShowLevelView(levelCfgId, OnFinishStoryLevel, needitemId, needItemCount); } public static void OnFinishStoryLevel(int levelCfgId, bool firstPass, bool success) { if (success) { //判断是否是首次打通最后一关 int nextLevelID = levelCfgId + 1; StoryLevelCfg nextLevelCfg = CommonDataManager.Tables.TblStoryLevelCfg.GetOrDefault(nextLevelID); var fistPassLastLvl = (nextLevelCfg == null) && firstPass; if (fistPassLastLvl) { MainStorySProxy.GetStoryBonusDate().Coroutine(); StoryLevelCfg levelCfg = CommonDataManager.Tables.TblStoryLevelCfg.GetOrDefault(levelCfgId); StoryChapterCfg nextStoryChapterCfg = CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId + 1); if (nextStoryChapterCfg != null) { StoryLevelCfg nextChapterLevelCfg = CommonDataManager.Tables.TblStoryLevelCfg.DataList .Where(a => a.Type == nextStoryChapterCfg.Type && a.SubType == nextStoryChapterCfg.SubType && a.ChapterId == nextStoryChapterCfg.Id) .ToList()[0]; int LevelID = nextChapterLevelCfg.Id; MainStoryDataManager.currentLevelCfgId = LevelID; } else { MainStoryDataManager.currentLevelCfgId = 0; } int index = 0; if (levelCfg.Type == ConstInstanceZonesType.Story && levelCfg.SubType == ConstInstanceZonesSubType.Hard) { index = 1; } //当副本表内最后一章通关时 if (nextStoryChapterCfg == null) { StoryChapterCfg lastChapter = CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId); ViewManager.Show(new object[] { index, lastChapter.Order }, true); return; } else { //ViewManager.Show(new object[] { index, nextStoryChapterCfg.order }, true); StoryChapterCfg previousChapterCfg = CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId); StoryChapterCfg nextChapterCfg = CommonDataManager.Tables.TblStoryChapterCfg.GetOrDefault(levelCfg.ChapterId + 1); bool lv = nextChapterCfg.Lvl < GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl); if (CheckSuitGot(previousChapterCfg.SuitId) && MainStoryDataManager.CheckChapterUnlock(levelCfg.ChapterId) && lv) { ViewManager.Show(new object[] { index, nextStoryChapterCfg.Order }, true); } else { //MainStoryDataManager.currentChapterCfgId = previousChapterCfg.id; ViewManager.Show(new object[] { previousChapterCfg.Id, 0 }, true); } } } else { ViewManager.Show(MainStoryDataManager.currentChapterCfgId); } } else { //异常返回到关卡列表界面 ViewManager.Show(MainStoryDataManager.currentChapterCfgId); } } public static bool CheckSuitGot(int suitID = 0) { if (suitID == 0) { return true; } int count; int totalCount; DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitID, out count, out totalCount); if (count >= totalCount) { return true; } return false; } public static void ShowCardStoryDialog(CardStoryCfg cardStoryCfg, CardData cardData) { ViewManager.Show( new object[] { cardStoryCfg.StoryStartID, true, new OnCompleteStoryDialogCall(OnCompleteCardStoryDialog), cardData, false }, true); } private static void OnCompleteCardStoryDialog(bool isSkip, object param) { //CardData cardData = param as CardData; //ViewManager.Show(cardData, new object[] { typeof(CardDetailView).FullName}, true); //ViewManager.Show(cardData); } public static void ShowPriorStoryDialog() { InstanceZonesDataManager.currentLevelCfgId = 100001001; string stroyStartID = "1"; // string stroyStartID = MainStoryDataManager.priorId; ViewManager.Show( new object[] { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog), null, false }, true); } private static void OnCompletePriorStoryDialog(bool done, object param) { //ViewManager.Show(MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(typeof(StoryChapterView).FullName), true); } public static void ShowFilingStoryDialog(StoryLevelCfg storyLevelCfg) { InstanceZonesDataManager.currentLevelCfgId = storyLevelCfg.Id; ViewManager.Show( new object[] { storyLevelCfg.StoryStartID, false, new OnCompleteStoryDialogCall(OnCompleteFilingStoryDialog), null, false }, true); } private static void OnCompleteFilingStoryDialog(bool isSkip, object param) { //InstanceZonesController.OnCompleteChapterStoryDialog(isSkip, param); //ViewManager.Show(MainStoryDataManager.currentChapterCfgId, null, true); //, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName) } } }