Exemplo n.º 1
0
        public static void InitializeLevelValues(ScoreManager newScoreManager)
        {
            //if both numbers are zero it means level is being tested from within the editor
            //in this case the scoremanager shoud go with the ScoreManager's inspector values
            if (lastChapterNumber != 0 && lastLevelNumber != 0)
            {
                //for analytics
                Instance.IncrementTimesPlayed();

                //print(Instance.ChapterInitList.Count);
                LevelInitData currentLevel = Instance.ChapterInitList[lastChapterNumber - 1].LevelInitList[lastLevelNumber - 1];

                newScoreManager.ChapterAnimalName  = currentLevel.ChapterAnimalName;
                newScoreManager.MaxTaps            = currentLevel.MaxTaps;
                newScoreManager.TwoStarLevel       = currentLevel.TwoStarLevel;
                newScoreManager.TwoStarBonus       = currentLevel.TwoStarBonus;
                newScoreManager.ThreeStarLevel     = currentLevel.ThreeStarBonus;
                newScoreManager.CoinsInLevel       = currentLevel.CoinsInLevel;
                newScoreManager.ChapterMainColor   = GetChapterMainColor(lastChapterNumber);
                newScoreManager.ChapterSecondColor = GetChapterSecondColor(lastChapterNumber);
                newScoreManager.ChapterSecondColor = GetChapterThirdColor(lastChapterNumber);
                newScoreManager.ChapterNumber      = lastChapterNumber;
                newScoreManager.LevelNumber        = lastLevelNumber;
            }
            else if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name.Length >= 10)
            {
                string sceneName           = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
                string chapterNumberString = sceneName.Substring(6, 2);
                string levelNumberString   = sceneName.Substring(8, 2);
                int    chapterNumber;
                int    levelNumber;
                if (int.TryParse(chapterNumberString, out chapterNumber) &&
                    int.TryParse(levelNumberString, out levelNumber))
                {
                    //for analytics
                    Instance.IncrementTimesPlayed();
                    LevelInitData currentLevel = Instance.ChapterInitList[chapterNumber - 1].LevelInitList[levelNumber - 1];
                    newScoreManager.ChapterAnimalName  = currentLevel.ChapterAnimalName;
                    newScoreManager.MaxTaps            = currentLevel.MaxTaps;
                    newScoreManager.TwoStarLevel       = currentLevel.TwoStarLevel;
                    newScoreManager.TwoStarBonus       = currentLevel.TwoStarBonus;
                    newScoreManager.ThreeStarLevel     = currentLevel.ThreeStarBonus;
                    newScoreManager.CoinsInLevel       = currentLevel.CoinsInLevel;
                    newScoreManager.ChapterMainColor   = GetChapterMainColor(chapterNumber);
                    newScoreManager.ChapterSecondColor = GetChapterSecondColor(chapterNumber);
                    newScoreManager.ChapterSecondColor = GetChapterSecondColor(chapterNumber);
                    newScoreManager.ChapterSecondColor = GetChapterThirdColor(chapterNumber);
                    newScoreManager.ChapterNumber      = chapterNumber;
                    newScoreManager.LevelNumber        = levelNumber;

                    lastChapterNumber = chapterNumber;

                    lastLevelNumber = levelNumber;
                }
            }
        }
Exemplo n.º 2
0
 public static void InitializateDevPanelValues(DevelopmentPanelManager newDevPanel)
 {
     //if both numbers are zero it means level is being tested from within the editor
     //in this case the scoremanager shoud go with the ScoreManager's inspector values
     if (lastChapterNumber != 0 && lastLevelNumber != 0)
     {
         LevelInitData currentLevel = Instance.ChapterInitList[lastChapterNumber - 1].LevelInitList[lastLevelNumber - 1];
         newDevPanel.MaxTaps        = currentLevel.MaxTaps;
         newDevPanel.TwoStarLevel   = currentLevel.TwoStarLevel;
         newDevPanel.TwoStarBonus   = currentLevel.TwoStarBonus;
         newDevPanel.ThreeStarLevel = currentLevel.ThreeStarBonus;
     }
 }
Exemplo n.º 3
0
        JSONArray GetLevelsData(JSONArray newArray, ChapterInitData currentChapter)
        {
            for (int i = 0; i < currentChapter.LevelInitList.Count; i++)
            {
                LevelInitData currentLevel = currentChapter.LevelInitList[i];

                JSONClass newNode = new JSONClass();
                newNode["LevelNumber"].AsInt    = currentLevel.LevelNumber;
                newNode["MaxTaps"].AsInt        = currentLevel.MaxTaps;
                newNode["ThreeStarLevel"].AsInt = currentLevel.ThreeStarLevel;
                newNode["TwoStarLevel"].AsInt   = currentLevel.TwoStarLevel;
                newNode["ThreeStarBonus"].AsInt = currentLevel.ThreeStarBonus;
                newNode["TwoStarBonus"].AsInt   = currentLevel.TwoStarBonus;
                newNode["CoinsInLevel"].AsInt   = currentLevel.CoinsInLevel;
                newArray.Add(newNode);
            }
            return(newArray);
        }
Exemplo n.º 4
0
        List <LevelInitData> SetUpLevels(JSONNode levelInfo, int chapterNumber, string chapterAnimal)
        {
            List <LevelInitData> newLevels = new List <LevelInitData>();

            for (int i = 0; i < levelInfo.Count; i++)
            {
                LevelInitData nextLevel = new LevelInitData();
                nextLevel.ChapterNumber     = chapterNumber;
                nextLevel.ChapterAnimalName = chapterAnimal;
                nextLevel.LevelNumber       = levelInfo[i]["LevelNumber"].AsInt;
                nextLevel.MaxTaps           = levelInfo[i]["MaxTaps"].AsInt;
                nextLevel.ThreeStarLevel    = levelInfo[i]["ThreeStarLevel"].AsInt;
                nextLevel.TwoStarLevel      = levelInfo[i]["TwoStarLevel"].AsInt;
                nextLevel.ThreeStarBonus    = levelInfo[i]["ThreeStarBonus"].AsInt;
                nextLevel.TwoStarBonus      = levelInfo[i]["TwoStarBonus"].AsInt;
                nextLevel.CoinsInLevel      = levelInfo[i]["CoinsInLevel"].AsInt;
                newLevels.Add(nextLevel);
            }
            return(newLevels);
        }
Exemplo n.º 5
0
        public static string GetChapterAnimalName(int chapterNumber, int levelNumber)
        {
            LevelInitData currentLevel = Instance.ChapterInitList[chapterNumber - 1].LevelInitList[levelNumber - 1];

            return(currentLevel.ChapterAnimalName);
        }
Exemplo n.º 6
0
        public static int GetCoinsInLevel(int chapterNumber, int levelNumber)
        {
            LevelInitData currentLevel = Instance.ChapterInitList[chapterNumber - 1].LevelInitList[levelNumber - 1];

            return(currentLevel.CoinsInLevel);
        }
Exemplo n.º 7
0
        public static int GetMaxTaps(int chapterNumber, int levelNumber)
        {
            LevelInitData currentLevel = Instance.ChapterInitList[chapterNumber - 1].LevelInitList[levelNumber - 1];

            return(currentLevel.MaxTaps);
        }