예제 #1
0
        void SetUpChapters(string chapterInfo)
        {
            JSONNode json = JSONNode.Parse(chapterInfo);

            for (int i = 0; i < json.Count; i++)
            {
                ChapterInitData nextChapter = new ChapterInitData();
                nextChapter.ChapterNumber      = json[i]["ChapterNumber"].AsInt;
                nextChapter.ChapterAnimalName  = json[i]["ChapterAnimalName"];
                nextChapter.ChapterMainColor   = HexUtility.HexToColor(json[i]["ChapterMainColor"]);
                nextChapter.ChapterSecondColor = HexUtility.HexToColor(json[i]["ChapterSecondColor"]);
                nextChapter.ChapterThirdColor  = HexUtility.HexToColor(json[i]["ChapterThirdColor"]);
                nextChapter.LevelInitList      = SetUpLevels(json[i]["Levels"], nextChapter.ChapterNumber, nextChapter.ChapterAnimalName);
                ChapterInitList.Add(nextChapter);
            }
        }
예제 #2
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);
        }
예제 #3
0
        JSONArray GetChaptersData(JSONArray baseArray)
        {
            for (int i = 0; i < ChapterInitList.Count; i++)
            {
                JSONClass       newNode        = new JSONClass();
                ChapterInitData currentChapter = ChapterInitList[i];
                newNode["ChapterNumber"].AsInt     = currentChapter.ChapterNumber;
                newNode["ChapterBonusScore"].AsInt = currentChapter.ChapterBonusScore;
                newNode["ChapterBonusCoins"].AsInt = currentChapter.ChapterBonusCoins;
                newNode["ChapterAnimalName"]       = currentChapter.ChapterAnimalName;
                newNode["ChapterMainColor"]        = HexUtility.ColorToHex(currentChapter.ChapterMainColor);
                newNode["ChapterSecondColor"]      = HexUtility.ColorToHex(currentChapter.ChapterSecondColor);
                newNode["ChapterThirdColor"]       = HexUtility.ColorToHex(currentChapter.ChapterThirdColor);

                newNode["Levels"] = GetLevelsData(new JSONArray(), currentChapter);
                baseArray.Add(newNode);
            }
            return(baseArray);
        }