Example #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"];
            hash           = hash.ToUpper();

            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"]);
            }
        }
Example #2
0
        public DifficultyLevel[] ConvertDifficultyLevels(IDifficultyBeatmap[] _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);
            }
        }
Example #3
0
        public DifficultyLevel[] ConvertDifficultyLevels(CustomSongInfo.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);
            }
        }