Ejemplo n.º 1
0
        public Song(JSONNode jsonNode)
        {
            id             = jsonNode["key"];
            beatname       = jsonNode["name"];
            ownerid        = jsonNode["uploaderId"];
            downloads      = jsonNode["downloadCount"];
            upvotes        = jsonNode["upVotes"];
            downvotes      = jsonNode["downVotes"];
            plays          = jsonNode["playedCount"];
            beattext       = jsonNode["description"];
            uploadtime     = jsonNode["createdAt"];
            songName       = jsonNode["songName"];
            songSubName    = jsonNode["songSubName"];
            authorName     = jsonNode["authorName"];
            beatsPerMinute = jsonNode["bpm"];
            coverUrl       = jsonNode["coverUrl"];
            downloadUrl    = jsonNode["downloadUrl"];
            hash           = jsonNode["hashMd5"];

            var difficultyNode = jsonNode["difficulties"];

            difficultyLevels = new DifficultyLevel[difficultyNode.Count];

            for (int i = 0; i < difficultyNode.Count; i++)
            {
                difficultyLevels[i] = new DifficultyLevel(difficultyNode[i]["difficulty"], difficultyNode[i]["difficultyRank"], difficultyNode[i]["audioPath"], difficultyNode[i]["jsonPath"]);
            }
        }
        public DifficultyLevel[] ConvertDifficultyLevels(LevelStaticData.DifficultyLevel[] _difficultyLevels)
        {
            if (_difficultyLevels != null && _difficultyLevels.Length > 0)
            {
                DifficultyLevel[] buffer = new DifficultyLevel[_difficultyLevels.Length];

                for (int i = 0; i < _difficultyLevels.Length; i++)
                {
                    buffer[i] = new DifficultyLevel(_difficultyLevels[i]);
                }


                return(buffer);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        public DifficultyLevel[] ConvertDifficultyLevels(IStandardLevelDifficultyBeatmap[] _difficultyLevels)
        {
            if (_difficultyLevels != null && _difficultyLevels.Length > 0)
            {
                DifficultyLevel[] buffer = new DifficultyLevel[_difficultyLevels.Length];

                for (int i = 0; i < _difficultyLevels.Length; i++)
                {
                    buffer[i] = new DifficultyLevel(_difficultyLevels[i].difficulty.ToString(), _difficultyLevels[i].difficultyRank, string.Empty);
                }


                return(buffer);
            }
            else
            {
                return(null);
            }
        }
        public Song(JSONNode jsonNode, JSONNode difficultyNode)
        {
            id             = jsonNode["id"].Value;
            beatname       = jsonNode["beatname"].Value;
            ownerid        = jsonNode["ownerid"].Value;
            downloads      = jsonNode["downloads"].Value;
            upvotes        = jsonNode["upvotes"].Value;
            plays          = jsonNode["plays"].Value;
            beattext       = jsonNode["beattext"].Value;
            uploadtime     = jsonNode["uploadtime"].Value;
            songName       = jsonNode["songName"].Value;
            songSubName    = jsonNode["songSubName"].Value;
            authorName     = jsonNode["authorName"].Value;
            beatsPerMinute = jsonNode["beatsPerMinute"].Value;
            img            = jsonNode["img"].Value;

            difficultyLevels = new DifficultyLevel[difficultyNode.Count];

            for (int i = 0; i < difficultyNode.Count; i++)
            {
                difficultyLevels[i] = new DifficultyLevel(difficultyNode[i]["difficulty"], difficultyNode[i]["difficultyRank"], difficultyNode[i]["audioPath"], difficultyNode[i]["jsonPath"]);
            }
        }