예제 #1
0
파일: MadLevel.cs 프로젝트: kewls74/game1
    /// <summary>
    /// Finds the last unlocked level (in the order). Be aware that locked flag in the new
    /// game is set when the player visits level select screen for the first time.
    /// </summary>
    /// <returns>The first locked level name or <code>null</code> if there's no level
    /// that is marked as locked.</returns>
    public static string FindLastUnlockedLevelName(string groupName) {
        LayoutUninitializedCheck();

        return FindLastLevelName(groupName, (level) => {
            if (MadLevelProfile.IsLockedSet(level.name)) {
                return !MadLevelProfile.IsLocked(level.name);
            } else {
                return !level.lockedByDefault;
            }
        });
    }
예제 #2
0
    /// <summary>
    /// Gets last unlocked icon or null if cannot be found.
    /// </summary>
    /// <returns></returns>
    public MadLevelIcon GetLastUnlockedIcon()
    {
        var lastUnlocked =
            from l in MadLevel.activeConfiguration.levels
            where l.groupId == configurationGroup &&
            l.type == MadLevel.Type.Level &&
            MadLevelProfile.IsLockedSet(l.name) &&
            MadLevelProfile.IsLocked(l.name) == false
            orderby l.order descending
            select l;
        var lastUnlockedLevel = lastUnlocked.FirstOrDefault();

        if (lastUnlockedLevel != null)
        {
            var lastUnlockedIcon = MadLevelLayout.current.GetIcon(lastUnlockedLevel.name);
            return(lastUnlockedIcon);
        }
        else
        {
            return(null);
        }
    }
    private string GetPropertyValue()
    {
        string levelName = icon.level.name;

        switch (propertyType)
        {
        case PropertyType.Completed:
            return(MadLevelProfile.IsCompleted(levelName).ToString());

        case PropertyType.Locked:
            return(MadLevelProfile.IsLocked(levelName).ToString());

        case PropertyType.LevelNumber:
            return(icon.levelNumber.text);

        case PropertyType.Custom:
            return(MadLevelProfile.GetLevelAny(levelName, customPropertyName, null));

        default:
            Debug.LogError("Unknown property type: " + propertyType);
            return(null);
        }
    }
예제 #4
0
    bool GetLevelBoolean()
    {
        string levelName = icon.level.name;

        switch (specialType)
        {
        case SpecialType.Regular:
            return(MadLevelProfile.GetLevelBoolean(levelName, name));

        case SpecialType.LevelNumber:
            return(MadLevelProfile.GetLevelBoolean(levelName, name));

        case SpecialType.Locked:
            return(MadLevelProfile.IsLocked(levelName));

        case SpecialType.Completed:
            return(MadLevelProfile.IsCompleted(levelName));

        default:
            MadDebug.Assert(false, "Unknown special type: " + specialType);
            return(false);
        }
    }
    public int CountLocked() {
        var levelNames = GetLevelNames();
        int result = 0;

        var layout = MadLevelLayout.TryGet();

        for (int i = 0; i < levelNames.Count; ++i) {
            var levelName = levelNames[i];

            // first look for a layout, because icons locked state are more trustworthy
            if (layout != null) {
                var icon = layout.GetIcon(levelName);
                if (icon != null) {
                    if (icon.locked) {
                        result++;
                    }

                    continue;
                }
            }

            // no layout or no icon
            if (MadLevelProfile.IsLockedSet(levelName)) {
                if (MadLevelProfile.IsLocked(levelName)) {
                    result++;
                }
            } else {
                var lockedByDefault = MadLevel.activeConfiguration.FindLevelByName(levelName).lockedByDefault;
                if (lockedByDefault) {
                    result++;
                }
            }
        }

        return result;
    }
예제 #6
0
 /// <summary>
 /// Finds the last unlocked level (in the order). Be aware that locked flag in the new
 /// game is set when the player visits level select screen for the first time.
 /// </summary>
 /// <returns>The first locked level name or <code>null</code> if there's no level
 /// that is marked as locked.</returns>
 public static string FindLastUnlockedLevelName() {
     return FindLastLevelName((level) => !MadLevelProfile.IsLocked(level.name));
 }
예제 #7
0
 /// <summary>
 /// Finds the first locked level (in the order). Be aware that locked flag in the new
 /// game is set when the player visits level select screen for the first time.
 /// </summary>
 /// <returns>The first locked level name or <code>null</code> if there's no level
 /// that is marked as locked.</returns>
 public static string FindFirstLockedLevelName() {
     return FindFirstLevelName((level) => MadLevelProfile.IsLocked(level.name));
 }
예제 #8
0
파일: MadLevel.cs 프로젝트: kewls74/game1
 /// <summary>
 /// Finds the last locked level (in the order). Be aware that locked flag in the new
 /// game is set when the player visits level select screen for the first time.
 /// </summary>
 /// <returns>The last locked level name or <code>null</code> if there's no level
 /// that is marked as locked.</returns>
 public static string FindLastLockedLevelName(string groupName) {
     return FindLastLevelName(groupName, (level) => MadLevelProfile.IsLocked(level.name));
 }