예제 #1
0
파일: ListManager.cs 프로젝트: zer/dnGrep
        private LevelTuple[] LoadOverrideTuples(AbstractNum abNum, int length)
        {
            var levels = abNum.ChildElements.Where(c => c is Level).Select(c => c as Level).ToArray();

            if (levels.Length == 0)
            {
                return(null);
            }

            LevelTuple[] levelTuples = new LevelTuple[length];
            for (int i = 0; i < length; i++)
            {
                LevelTuple tuple;
                if (i >= levels.Length)
                {
                    tuple = new LevelTuple("%" + i + ".");
                }
                else
                {
                    if (levels[i] != null)
                    {
                        tuple = BuildTuple(i, levels[i]);
                    }
                    else
                    {
                        tuple = new LevelTuple("%" + i + ".");
                    }
                }
                levelTuples[i] = tuple;
            }
            return(levelTuples);
        }
예제 #2
0
    public void AddLevel(int plevel, int pcollectible)
    {
        LevelTuple lt = new LevelTuple();

        lt.Level       = TotalLevel;
        lt.Maze        = plevel;
        lt.Collectible = pcollectible;
        TotalLevel++;

        levelList.Add(lt);
    }
예제 #3
0
파일: ListManager.cs 프로젝트: zer/dnGrep
        private ParagraphLevelCounter LoadLevelTuples(AbstractNum abNum)
        {
            //Unfortunately, we need to go this far into the underlying structure
            //to get the abstract num information for the edge case where
            //someone skips a level and the format is not context-free, e.g. "1.B.i".

            var lvlArray = abNum.ChildElements.Where(c => c is Level).Select(c => c as Level).ToArray();

            LevelTuple[] levels = new LevelTuple[lvlArray.Length];
            for (int i = 0; i < levels.Length; i++)
            {
                levels[i] = BuildTuple(i, lvlArray[i]);
            }
            return(new ParagraphLevelCounter(levels));
        }
예제 #4
0
    /// <summary>
    /// Inits each variable once, at the beginning of the game.
    /// Loads the last state of the game, for keeping the player progress.
    /// </summary>
    private void Init()
    {
        // Add the AdsManager Component to the object
        _adsManager = gameObject.AddComponent(typeof(AdsManager)) as AdsManager;

        _categoryLevels   = new Dictionary <LEVEL_CATEGORY, List <Level> >();
        _categoryMaxLevel = new Dictionary <LEVEL_CATEGORY, LevelTuple>();

        for (int i = 1; i <= NUM_CATEGORIES; i++)
        {
            LevelTuple lt = new LevelTuple();
            lt.currentLevel = 0;
            lt.maxLevel     = 0;
            _categoryMaxLevel.Add((LEVEL_CATEGORY)i, lt);
        }
        _levelReader = new LevelReader();

        _coins  = 0;
        _medals = 0;
        Serializer.Load();
    }