1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 20:12:57 +08:00

Move BPM out of OnlineInfo

This commit is contained in:
iiSaLMaN 2019-07-07 20:11:44 +03:00
parent 6ee10640e3
commit 3ea9629daf
10 changed files with 14 additions and 20 deletions

View File

@ -96,11 +96,11 @@ namespace osu.Game.Tests.Visual.Online
FavouriteCount = 456, FavouriteCount = 456,
Submitted = DateTime.Now, Submitted = DateTime.Now,
Ranked = DateTime.Now, Ranked = DateTime.Now,
BPM = 111,
HasVideo = true, HasVideo = true,
HasStoryboard = true, HasStoryboard = true,
Covers = new BeatmapSetOnlineCovers(), Covers = new BeatmapSetOnlineCovers(),
}, },
BPM = 111,
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() },
Beatmaps = new List<BeatmapInfo> Beatmaps = new List<BeatmapInfo>
{ {
@ -169,11 +169,11 @@ namespace osu.Game.Tests.Visual.Online
FavouriteCount = 456, FavouriteCount = 456,
Submitted = DateTime.Now, Submitted = DateTime.Now,
Ranked = DateTime.Now, Ranked = DateTime.Now,
BPM = 111,
HasVideo = true, HasVideo = true,
HasStoryboard = true, HasStoryboard = true,
Covers = new BeatmapSetOnlineCovers(), Covers = new BeatmapSetOnlineCovers(),
}, },
BPM = 111,
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() }, Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() },
Beatmaps = new List<BeatmapInfo> Beatmaps = new List<BeatmapInfo>
{ {

View File

@ -47,11 +47,11 @@ namespace osu.Game.Tests.Visual.Online
Preview = @"https://b.ppy.sh/preview/12345.mp3", Preview = @"https://b.ppy.sh/preview/12345.mp3",
PlayCount = 123, PlayCount = 123,
FavouriteCount = 456, FavouriteCount = 456,
BPM = 111,
HasVideo = true, HasVideo = true,
HasStoryboard = true, HasStoryboard = true,
Covers = new BeatmapSetOnlineCovers(), Covers = new BeatmapSetOnlineCovers(),
}, },
BPM = 111,
Beatmaps = new List<BeatmapInfo> Beatmaps = new List<BeatmapInfo>
{ {
new BeatmapInfo new BeatmapInfo

View File

@ -300,10 +300,7 @@ namespace osu.Game.Tests.Visual.SongSelect
}, },
Beatmaps = beatmaps, Beatmaps = beatmaps,
DateAdded = DateTimeOffset.UtcNow, DateAdded = DateTimeOffset.UtcNow,
OnlineInfo = new BeatmapSetOnlineInfo BPM = bpm,
{
BPM = bpm,
}
}; };
} }
} }

View File

@ -158,7 +158,7 @@ namespace osu.Game.Tournament.Components
return; return;
} }
var bpm = beatmap.BeatmapSet.OnlineInfo.BPM; var bpm = beatmap.BeatmapSet.BPM;
var length = beatmap.OnlineInfo.Length; var length = beatmap.OnlineInfo.Length;
string hardRockExtra = ""; string hardRockExtra = "";
string srExtra = ""; string srExtra = "";

View File

@ -272,10 +272,7 @@ namespace osu.Game.Beatmaps
Beatmaps = new List<BeatmapInfo>(), Beatmaps = new List<BeatmapInfo>(),
Metadata = beatmap.Metadata, Metadata = beatmap.Metadata,
DateAdded = DateTimeOffset.UtcNow, DateAdded = DateTimeOffset.UtcNow,
OnlineInfo = new BeatmapSetOnlineInfo BPM = beatmap.ControlPointInfo.BPMMode,
{
BPM = beatmap.ControlPointInfo.BPMMode,
}
}; };
} }

View File

@ -35,6 +35,11 @@ namespace osu.Game.Beatmaps
[NotMapped] [NotMapped]
public BeatmapSetMetrics Metrics { get; set; } public BeatmapSetMetrics Metrics { get; set; }
/// <summary>
/// The beats per minute of this beatmap set's song.
/// </summary>
public double BPM { get; set; }
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0; public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0;
public double MaxLength => Beatmaps?.Max(b => b.OnlineInfo.Length) ?? 0; public double MaxLength => Beatmaps?.Max(b => b.OnlineInfo.Length) ?? 0;

View File

@ -51,11 +51,6 @@ namespace osu.Game.Beatmaps
/// </summary> /// </summary>
public string Preview { get; set; } public string Preview { get; set; }
/// <summary>
/// The beats per minute of this beatmap set's song.
/// </summary>
public double BPM { get; set; }
/// <summary> /// <summary>
/// The amount of plays this beatmap set has. /// The amount of plays this beatmap set has.
/// </summary> /// </summary>

View File

@ -77,13 +77,13 @@ namespace osu.Game.Online.API.Requests.Responses
Metadata = this, Metadata = this,
Status = Status, Status = Status,
Metrics = ratings == null ? null : new BeatmapSetMetrics { Ratings = ratings }, Metrics = ratings == null ? null : new BeatmapSetMetrics { Ratings = ratings },
BPM = bpm,
OnlineInfo = new BeatmapSetOnlineInfo OnlineInfo = new BeatmapSetOnlineInfo
{ {
Covers = covers, Covers = covers,
Preview = preview, Preview = preview,
PlayCount = playCount, PlayCount = playCount,
FavouriteCount = favouriteCount, FavouriteCount = favouriteCount,
BPM = bpm,
Status = Status, Status = Status,
HasVideo = hasVideo, HasVideo = hasVideo,
HasStoryboard = hasStoryboard, HasStoryboard = hasStoryboard,

View File

@ -50,7 +50,7 @@ namespace osu.Game.Overlays.BeatmapSet
private void updateDisplay() private void updateDisplay()
{ {
bpm.Value = BeatmapSet?.OnlineInfo?.BPM.ToString(@"0.##") ?? "-"; bpm.Value = BeatmapSet?.BPM.ToString(@"0.##") ?? "-";
if (beatmap == null) if (beatmap == null)
{ {

View File

@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Carousel
return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded); return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
case SortMode.BPM: case SortMode.BPM:
return BeatmapSet.OnlineInfo.BPM.CompareTo(otherSet.BeatmapSet.OnlineInfo.BPM); return BeatmapSet.BPM.CompareTo(otherSet.BeatmapSet.BPM);
case SortMode.Length: case SortMode.Length:
return BeatmapSet.MaxLength.CompareTo(otherSet.BeatmapSet.MaxLength); return BeatmapSet.MaxLength.CompareTo(otherSet.BeatmapSet.MaxLength);