| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 | using System.Collections.Generic;using UnityEngine;using System.Collections;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 = StoryLevelCfgArray.Instance.GetCfg(nextLevelID);                var fistPassLastLvl = (nextLevelCfg == null) && firstPass;                if (fistPassLastLvl)                {                    MainStorySProxy.GetStoryBonusDate().Coroutine();                    StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);                    StoryChapterCfg nextStoryChapterCfg = StoryChapterCfgArray.Instance.GetCfg(levelCfg.chapterId + 1);                    if (nextStoryChapterCfg != null)                    {                        StoryLevelCfg nextChapterLevelCfg = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(nextStoryChapterCfg.type, nextStoryChapterCfg.subType, nextStoryChapterCfg.id)[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 = StoryChapterCfgArray.Instance.GetCfg(levelCfg.chapterId);                        ViewManager.Show<StoryChapterListView>(new object[] { index, lastChapter.order }, true);                        return;                    }                    else                    {                        //ViewManager.Show<StoryChapterListView>(new object[] { index, nextStoryChapterCfg.order }, true);                        StoryChapterCfg previousChapterCfg = StoryChapterCfgArray.Instance.GetCfg(levelCfg.chapterId);                        StoryChapterCfg nextChapterCfg = StoryChapterCfgArray.Instance.GetCfg(levelCfg.chapterId + 1);                        bool lv = nextChapterCfg.lvl < GameGlobal.myNumericComponent.GetAsInt(NumericType.Lvl);                        if (CheckSuitGot(previousChapterCfg.suitId) && MainStoryDataManager.CheckChapterUnlock(levelCfg.chapterId) && lv)                        {                            ViewManager.Show<StoryChapterListView>(new object[] { index, nextStoryChapterCfg.order }, true);                        }                        else                        {                            //MainStoryDataManager.currentChapterCfgId = previousChapterCfg.id;                            ViewManager.Show<StoryChapterView>(new object[] { previousChapterCfg.id, 0 }, true);                        }                    }                                    }                else                {                    ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId);                }            }            else            {                //异常返回到关卡列表界面                ViewManager.Show<StoryChapterView>(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<StoryDialogView>(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<CardFosterView>(cardData, new object[] { typeof(CardDetailView).FullName}, true);            //ViewManager.Show<CardStoryView>(cardData);        }        public static void ShowPriorStoryDialog()        {            InstanceZonesDataManager.currentLevelCfgId = 100001001;            string stroyStartID = "1";            // string stroyStartID = MainStoryDataManager.priorId;            ViewManager.Show<StoryDialogView>(new object[] { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog),null,false }, true);        }        private static void OnCompletePriorStoryDialog(bool done, object param)        {            //ViewManager.Show<StoryChapterView>(MainStoryDataManager.currentChapterCfgId, ViewManager.GetGoBackDatas(typeof(StoryChapterView).FullName), true);        }        public static void ShowFilingStoryDialog(StoryLevelCfg storyLevelCfg)        {            InstanceZonesDataManager.currentLevelCfgId = storyLevelCfg.id;            ViewManager.Show<StoryDialogView>(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<StudioFilingView>(MainStoryDataManager.currentChapterCfgId, null, true);            //, ViewManager.GetGoBackDatas(typeof(StudioFilingView).FullName)        }    }}
 |