Ejemplo n.º 1
0
 public BeatSongDataDifficultyStats GetBeatStarSongDiffculityStats(BeatSongData song, BeatmapDifficulty difficulty, BeatDataCharacteristics beatDataCharacteristics)
 {
     if (!song.Characteristics.TryGetValue(beatDataCharacteristics, out var dic))
     {
         return(null);
     }
     if (!dic.TryGetValue(BeatMapCoreConverter.ConvertToBeatMapDifficulity(difficulty), out var result))
     {
         return(null);
     }
     return(result);
 }
Ejemplo n.º 2
0
 public BeatSongDataDifficultyStats GetBeatStarSongDiffculityStats(BeatSongData song, BeatmapDifficulty difficulty)
 {
     return(this.GetBeatStarSongDiffculityStats(song, difficulty, BeatDataCharacteristics.Standard));
 }
Ejemplo n.º 3
0
        public BeatSongData GetBeatStarSong(CustomPreviewBeatmapLevel beatmapLevel)
        {
            if (!this._init)
            {
                return(null);
            }
            var hash = beatmapLevel.GetHashOrLevelID();

            if (hash.Length != 40)
            {
                return(null);
            }
            this._songDetails.songs.FindByHash(hash, out var song);
            var result = new BeatSongData
            {
                Characteristics = new ConcurrentDictionary <BeatDataCharacteristics, ConcurrentDictionary <BeatMapDifficulty, BeatSongDataDifficultyStats> >()
            };

            foreach (var chara in song.difficulties.GroupBy(x => x.characteristic))
            {
                var characteristics = SongDetailsConveter.ConvertToBeatDataCharacteristics(chara.Key);
                var dic             = new ConcurrentDictionary <BeatMapDifficulty, BeatSongDataDifficultyStats>();
                foreach (var diff in chara)
                {
                    var diffData = new BeatSongDataDifficultyStats
                    {
                        Difficulty      = SongDetailsConveter.ConvertToBeatMapDifficulty(diff.difficulty),
                        Star            = diff.stars,
                        NJS             = diff.njs,
                        Bombs           = (int)diff.bombs,
                        Notes           = (int)diff.notes,
                        Obstacles       = (int)diff.obstacles,
                        PP              = diff.approximatePpValue,
                        Mods            = SongDetailsConveter.ConvertToRecomendMod(diff.mods),
                        Ranked          = diff.ranked,
                        Song            = result,
                        Characteristics = characteristics
                    };
                    dic.TryAdd(diffData.Difficulty, diffData);
                }
                result.Characteristics.TryAdd(characteristics, dic);
            }
            result.Key             = song.key;
            result.BPM             = song.bpm;
            result.Rating          = song.rating;
            result.DownloadCount   = (int)song.downloadCount;
            result.Upvotes         = (int)song.upvotes;
            result.Downvotes       = (int)song.downvotes;
            result.SongDuration    = (int)song.songDuration.TotalSeconds;
            result.DiffOffset      = (int)song.diffOffset;
            result.DiffCount       = song.diffCount;
            result.RankedStatus    = SongDetailsConveter.ConvertToTRankStatus(song.rankedStatus);
            result.UploadTime      = song.uploadTime;
            result.Hash            = song.hash;
            result.SongName        = song.songName;
            result.SongAuthorName  = song.songAuthorName;
            result.LevelAuthorName = song.levelAuthorName;
            result.CoverURL        = song.coverURL;
            result.UploaderName    = song.uploaderName;
            return(result);
        }