Esempio n. 1
0
    public void CreateLevelNodes()
    {
        var gm = GetGameManager();

        var worldsUnlocked = _worldsManager.GetUnlockWorlds();

        foreach (var lvlInfo in gm.LevelInfoLoader.LevelInfoList.list)
        {
            var lvlMode = GameUtils.ToEnum(lvlInfo.mode, LevelMode.Normal);
            if (lvlMode == LevelMode.Tutorial && !gm.tutorialManager.UserAgreedWithMakingFirstTutorial)
            {
                continue;//if user didnt accept doing tutorial, continue and don't show tutorial's node.
            }
            bool unlocked = false;
            foreach (var worldId in worldsUnlocked)
            {
                if (worldId == lvlInfo.worldId)
                {
                    unlocked = true;
                    break;
                }
            }
            if (lvlInfo.worldId == 0)
            {
                _mainMapCanvas.AddLevelButton(lvlInfo, OnLevelNodeClick, gm, true, 0);
                continue;
            }

            var starsLeft    = _worldsManager.GetStarsLeftAmount(lvlInfo.worldId);
            var allLevelsWon = gm.User.LevelProgressManager.AreLevelsWonByWorld(lvlInfo.worldId - 1);

            _mainMapCanvas.AddLevelButton(lvlInfo, OnLevelNodeClick, gm, unlocked /*&& allLevelsWon*/, starsLeft);
        }
    }
Esempio n. 2
0
    public void CreateLevelNodes()
    {
        var gm = GetRealGameManager();

        var worldsUnlocked = _worldsManager.GetUnlockWorlds();

        foreach (var lvlInfo in gm.LevelInfoLoader.LevelInfoList.list)
        {
            bool unlocked = false;
            foreach (var worldId in worldsUnlocked)
            {
                if (worldId == lvlInfo.worldId)
                {
                    unlocked = true;
                    break;
                }
            }
            if (lvlInfo.worldId == 0)
            {
                _mainMapCanvas.AddLevelButton(lvlInfo, OnLevelNodeClick, gm, true, 0);
                continue;
            }

            var starsLeft    = _worldsManager.GetStarsLeftAmount(lvlInfo.worldId);
            var allLevelsWon = gm.User.LevelProgressManager.AreLevelsWonByWorld(lvlInfo.worldId - 1);

            _mainMapCanvas.AddLevelButton(lvlInfo, OnLevelNodeClick, gm, unlocked && allLevelsWon, starsLeft);
        }
    }