|
@@ -151,15 +151,19 @@ namespace GFGGame
|
|
|
}
|
|
|
|
|
|
//检查指定章节对应的普通章节是否通关
|
|
|
- public static bool CheckNeedChapterPass(int chapterId)
|
|
|
+ public static bool CheckNeedChapterPass(int chapterId, out int needChapterId)
|
|
|
{
|
|
|
- var chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterId);
|
|
|
- if (chapterCfg != null)
|
|
|
-{
|
|
|
- var passLevelOrder = InstanceZonesDataManager.GetPassLevelOrder(chapterCfg.type, chapterCfg.subType, chapterCfg.id);
|
|
|
- return chapterCfg.levelCount <= passLevelOrder;
|
|
|
+ StoryChapterCfg chapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterId);
|
|
|
+ needChapterId = chapterCfg.needChapterId;
|
|
|
+ if (chapterCfg.needChapterId > 0)
|
|
|
+ {
|
|
|
+ var preChapterCfg = StoryChapterCfgArray.Instance.GetCfg(chapterCfg.needChapterId);
|
|
|
+ if (preChapterCfg != null)
|
|
|
+ {
|
|
|
+ return InstanceZonesDataManager.CheckChapterPass(preChapterCfg.type, preChapterCfg.subType, preChapterCfg.id, preChapterCfg.levelCount);
|
|
|
+ }
|
|
|
}
|
|
|
- return false;
|
|
|
+ return true;
|
|
|
}
|
|
|
|
|
|
public static bool CheckChapterUnlock(int chapterId)
|
|
@@ -169,40 +173,28 @@ namespace GFGGame
|
|
|
{
|
|
|
return false;
|
|
|
}
|
|
|
- if (CalculateHelper.CheckChapterIsHard(chapterId))
|
|
|
- {
|
|
|
- //对应普通剧情的章需要开启
|
|
|
- if (!CheckNeedChapterPass(chapterId))
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- //前一精英章需要通关
|
|
|
- if (chapterId - 1 > GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterJY))
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ //上一关卡
|
|
|
+ int preChapterId = chapterId - 1;
|
|
|
+ var preChapterCfg = StoryChapterCfgArray.Instance.GetCfg(preChapterId);
|
|
|
+ if(preChapterCfg != null)
|
|
|
{
|
|
|
- if (chapterId - 1 > GameGlobal.myNumericComponent.GetAsInt(NumericType.Chapter))
|
|
|
- {
|
|
|
- return false;
|
|
|
- }
|
|
|
+ return InstanceZonesDataManager.CheckChapterPass(preChapterCfg.type, preChapterCfg.subType, preChapterCfg.id, preChapterCfg.levelCount);
|
|
|
}
|
|
|
- return true;
|
|
|
+ //前置关卡
|
|
|
+ return CheckNeedChapterPass(chapterId, out var needChapterId);
|
|
|
}
|
|
|
|
|
|
- public static bool CheckLevelUnlock(int chapterId, int level)
|
|
|
+ public static bool CheckLevelUnlock(int levelCfgId)
|
|
|
{
|
|
|
- int passChapter = GetPassChapter(chapterId);
|
|
|
- int passLevel = GetPassLevel(chapterId);
|
|
|
- if (chapterId <= passChapter)
|
|
|
+ var levelCfg = StoryLevelCfgArray.Instance.GetCfg(levelCfgId);
|
|
|
+ if (levelCfg != null)
|
|
|
{
|
|
|
- return true;
|
|
|
- }
|
|
|
- if (chapterId == passChapter + 1 && level <= passLevel + 1)
|
|
|
- {
|
|
|
- return true;
|
|
|
+ if (!CheckChapterUnlock(levelCfg.chapterId))
|
|
|
+ {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ var passLevelOrder = InstanceZonesDataManager.GetPassLevelOrder(levelCfg.type, levelCfg.subType, levelCfg.chapterId);
|
|
|
+ return levelCfg.order <= passLevelOrder + 1;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -270,84 +262,6 @@ namespace GFGGame
|
|
|
return (score > fightCfg.score1);
|
|
|
}
|
|
|
|
|
|
- public static int GetPassChapter(int fromChapter)
|
|
|
- {
|
|
|
- if (CalculateHelper.CheckChapterIsHard(fromChapter))
|
|
|
- {
|
|
|
- return GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterJY);
|
|
|
- }
|
|
|
- return GameGlobal.myNumericComponent.GetAsInt(NumericType.Chapter);
|
|
|
- }
|
|
|
-
|
|
|
- public static int GetPassLevel(int fromChapter)
|
|
|
- {
|
|
|
- if (CalculateHelper.CheckChapterIsHard(fromChapter))
|
|
|
- {
|
|
|
- return GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterLvlJY);
|
|
|
- }
|
|
|
- return GameGlobal.myNumericComponent.GetAsInt(NumericType.ChapterLvl);
|
|
|
- }
|
|
|
-
|
|
|
- public static List<ItemData> PassCurrentLevel(out bool fistPassLastLvl, out bool curLvfirstPass)
|
|
|
- {
|
|
|
- fistPassLastLvl = false;
|
|
|
- curLvfirstPass = false;
|
|
|
- List<ItemData> currentBonusList = new List<ItemData>();
|
|
|
- //if (!CheckCurrentLevelPass())
|
|
|
- //{
|
|
|
- // curLvfirstPass = true;
|
|
|
- // int tempPassLevel = currentLevel;
|
|
|
- // int tempPassChapter = GetPassChapter(currentChapter);
|
|
|
- // int nextLevel = currentLevel + 1;
|
|
|
- // int nextLevelID = currentChapter*GameConst.STORY_LEVEL_KEY_NUM + nextLevel;
|
|
|
- // StoryLevelCfg nextLevelCfg = StoryLevelCfgArray.Instance.GetCfg(nextLevelID);
|
|
|
- // if (nextLevelCfg == null)
|
|
|
- // {
|
|
|
- // tempPassChapter = currentChapter;
|
|
|
- // tempPassLevel = 0;
|
|
|
- // fistPassLastLvl = true;
|
|
|
- // }
|
|
|
- // SetPassData(tempPassChapter, tempPassLevel);
|
|
|
- // GameProxy.ReqUpdateStoryProgress(_passChapter, _passLevel, _passChapterJY, _passLevelJY);
|
|
|
- // currentBonusList = StoryBonusDataCache.GetBonusList(currentLevelID, true, true);
|
|
|
- //}
|
|
|
- //else
|
|
|
- //{
|
|
|
- //currentBonusList = StoryBonusDataCache.GetBonusList(currentLevelID, false, true);
|
|
|
- //}
|
|
|
- //StoryLevelCfg levelCfg = StoryLevelCfgArray.Instance.GetCfg(StoryDataManager.currentLevelID);
|
|
|
- ////消耗体力
|
|
|
- //if (currentBonusList != null && currentBonusList.Count > 0)
|
|
|
- //{
|
|
|
- // if (GameGlobal.myNumericComponent.GetAsInt(NumericType.Power) >= levelCfg.power)
|
|
|
- // {
|
|
|
- // RoleDataManager.power -= levelCfg.power;
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // RoleDataManager.power = 0;
|
|
|
- // }
|
|
|
- //}
|
|
|
- //消耗推荐次数
|
|
|
- //if (usedRecommend)
|
|
|
- //{
|
|
|
- // usedRecommend = false;
|
|
|
- // //_recommendCount--;
|
|
|
- // //GameProxy.ReqUpdateRecommendCount(_recommendCount);
|
|
|
- //}
|
|
|
- //经验奖励
|
|
|
- //if (levelCfg.fightID != null && levelCfg.fightID.Length > 0)
|
|
|
- //{
|
|
|
- // StoryFightCfg fightCfg = StoryFightCfgArray.Instance.GetCfg(levelCfg.fightID);
|
|
|
- // RoleDataManager.exp += fightCfg.exp;
|
|
|
- //}
|
|
|
- //foreach (ItemData itemData in currentBonusList)
|
|
|
- //{
|
|
|
- // ItemDataManager.Add(itemData.id, itemData.num);
|
|
|
- //}
|
|
|
- return currentBonusList;
|
|
|
- }
|
|
|
-
|
|
|
public static int GetChapterStarCount(int chapterID)
|
|
|
{
|
|
|
var star = 0;
|