mirror of
https://github.com/ppy/osu.git
synced 2025-03-22 13:17:45 +08:00
Move Length out of OnlineInfo
This commit is contained in:
parent
3ea9629daf
commit
729f0901f7
@ -108,6 +108,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
StarDifficulty = 9.99,
|
||||
Version = @"TEST",
|
||||
Length = 456000,
|
||||
Ruleset = maniaRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
@ -118,7 +119,6 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
OnlineInfo = new BeatmapOnlineInfo
|
||||
{
|
||||
Length = 456000,
|
||||
CircleCount = 111,
|
||||
SliderCount = 12,
|
||||
PlayCount = 222,
|
||||
@ -181,6 +181,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
StarDifficulty = 5.67,
|
||||
Version = @"ANOTHER TEST",
|
||||
Length = 123000,
|
||||
Ruleset = taikoRuleset,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
@ -191,7 +192,6 @@ namespace osu.Game.Tests.Visual.Online
|
||||
},
|
||||
OnlineInfo = new BeatmapOnlineInfo
|
||||
{
|
||||
Length = 123000,
|
||||
CircleCount = 123,
|
||||
SliderCount = 45,
|
||||
PlayCount = 567,
|
||||
|
@ -275,14 +275,11 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
OnlineBeatmapID = beatmapId,
|
||||
Path = "normal.osu",
|
||||
Version = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss})",
|
||||
Length = length,
|
||||
BaseDifficulty = new BeatmapDifficulty
|
||||
{
|
||||
OverallDifficulty = 3.5f,
|
||||
},
|
||||
OnlineInfo = new BeatmapOnlineInfo
|
||||
{
|
||||
Length = length,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -159,7 +159,7 @@ namespace osu.Game.Tournament.Components
|
||||
}
|
||||
|
||||
var bpm = beatmap.BeatmapSet.BPM;
|
||||
var length = beatmap.OnlineInfo.Length;
|
||||
var length = beatmap.Length;
|
||||
string hardRockExtra = "";
|
||||
string srExtra = "";
|
||||
|
||||
|
@ -51,6 +51,11 @@ namespace osu.Game.Beatmaps
|
||||
[NotMapped]
|
||||
public BeatmapOnlineInfo OnlineInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The length in milliseconds of this beatmap's song.
|
||||
/// </summary>
|
||||
public double Length { get; set; }
|
||||
|
||||
public string Path { get; set; }
|
||||
|
||||
[JsonProperty("file_sha2")]
|
||||
|
@ -303,11 +303,7 @@ namespace osu.Game.Beatmaps
|
||||
beatmap.BeatmapInfo.Ruleset = ruleset;
|
||||
// TODO: this should be done in a better place once we actually need to dynamically update it.
|
||||
beatmap.BeatmapInfo.StarDifficulty = ruleset?.CreateInstance().CreateDifficultyCalculator(new DummyConversionBeatmap(beatmap)).Calculate().StarRating ?? 0;
|
||||
|
||||
beatmap.BeatmapInfo.OnlineInfo = new BeatmapOnlineInfo
|
||||
{
|
||||
Length = beatmap.CalculateLength(),
|
||||
};
|
||||
beatmap.BeatmapInfo.Length = beatmap.CalculateLength();
|
||||
|
||||
beatmapInfos.Add(beatmap.BeatmapInfo);
|
||||
}
|
||||
|
@ -8,11 +8,6 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public class BeatmapOnlineInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// The length in milliseconds of this beatmap's song.
|
||||
/// </summary>
|
||||
public double Length { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of circles in this beatmap.
|
||||
/// </summary>
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
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.Length) ?? 0;
|
||||
|
||||
[NotMapped]
|
||||
public bool DeletePending { get; set; }
|
||||
|
@ -71,6 +71,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
StarDifficulty = starDifficulty,
|
||||
OnlineBeatmapID = OnlineBeatmapID,
|
||||
Version = version,
|
||||
Length = length,
|
||||
Status = Status,
|
||||
BeatmapSet = set,
|
||||
Metrics = metrics,
|
||||
@ -85,7 +86,6 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
PlayCount = playCount,
|
||||
PassCount = passCount,
|
||||
Length = length,
|
||||
CircleCount = circleCount,
|
||||
SliderCount = sliderCount,
|
||||
},
|
||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
}
|
||||
else
|
||||
{
|
||||
length.Value = TimeSpan.FromSeconds(beatmap.OnlineInfo.Length).ToString(@"m\:ss");
|
||||
length.Value = TimeSpan.FromSeconds(beatmap.Length).ToString(@"m\:ss");
|
||||
circleCount.Value = beatmap.OnlineInfo.CircleCount.ToString();
|
||||
sliderCount.Value = beatmap.OnlineInfo.SliderCount.ToString();
|
||||
}
|
||||
|
@ -50,8 +50,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
case SortMode.Length:
|
||||
// Length comparing must be in seconds
|
||||
if (TimeSpan.FromMilliseconds(Beatmap.OnlineInfo.Length).Seconds != TimeSpan.FromMilliseconds(otherBeatmap.Beatmap.OnlineInfo.Length).Seconds)
|
||||
return Beatmap.OnlineInfo.Length.CompareTo(otherBeatmap.Beatmap.OnlineInfo.Length);
|
||||
if (TimeSpan.FromMilliseconds(Beatmap.Length).Seconds != TimeSpan.FromMilliseconds(otherBeatmap.Beatmap.Length).Seconds)
|
||||
return Beatmap.Length.CompareTo(otherBeatmap.Beatmap.Length);
|
||||
|
||||
goto case SortMode.Difficulty;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user