示例#1
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);
        }
示例#2
0
        public double GetPP(CustomPreviewBeatmapLevel beatmapLevel, BeatmapDifficulty difficulty, BeatDataCharacteristics beatDataCharacteristics)
        {
            if (beatDataCharacteristics == BeatDataCharacteristics.Standard && this._downloader.Init && this._downloader.RowPPs.TryGetValue(beatmapLevel.GetHashOrLevelID().ToUpper(), out var pp))
            {
                // PP counterと同じ処理
                switch (difficulty)
                {
                case BeatmapDifficulty.Easy:
                    return(pp.EasySoloStandard);

                case BeatmapDifficulty.Normal:
                    return(pp.NormalSoloStandard);

                case BeatmapDifficulty.Hard:
                    return(pp.HardSoloStandard);

                case BeatmapDifficulty.Expert:
                    return(pp.ExpertSoloStandard);

                case BeatmapDifficulty.ExpertPlus:
                    return(pp.ExpertPlusSoloStandard);

                default:
                    break;
                }
            }
            var song = this.GetBeatStarSongDiffculityStats(beatmapLevel, difficulty, beatDataCharacteristics);

            if (song != null)
            {
                return(song.PP);
            }
            return(0);
        }