Exemplo n.º 1
0
    public static bool IsLevelUnlocked(int episodeIndex, int levelIndex)
    {
        bool flag = LevelInfo.IsStarLevel(episodeIndex, levelIndex);

        if (GameProgress.AllLevelsUnlocked() || levelIndex == 0)
        {
            return(true);
        }
        if (Singleton <BuildCustomizationLoader> .Instance.CheatsEnabled && GameProgress.AllFreeLevelsUnlocked() && !LevelInfo.IsContentLimited(episodeIndex, levelIndex))
        {
            return(true);
        }
        int           index      = LevelInfo.PreviousNormalLevelIndex(episodeIndex, levelIndex);
        List <string> levelNames = LevelInfo.GetLevelNames(episodeIndex);
        bool          result     = GameProgress.IsLevelCompleted(levelNames[index]);

        if (!flag && !Singleton <BuildCustomizationLoader> .Instance.IsChina)
        {
            return(result);
        }
        if (!flag && Singleton <BuildCustomizationLoader> .Instance.IsChina)
        {
            return(true);
        }
        int num;
        int num2;

        LevelInfo.GetStarLevelStars(episodeIndex, levelIndex, out num, out num2);
        return(num >= num2);
    }