1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 20:07:29 +08:00

proper round + std bpm

This commit is contained in:
n4b3l 2016-12-18 03:53:26 +01:00
parent 63dd8893d9
commit 3d64bee069

View File

@ -177,15 +177,17 @@ namespace osu.Game.Screens.Select
{ {
double bpmMax = double.MinValue; double bpmMax = double.MinValue;
double bpmMin = double.MaxValue; double bpmMin = double.MaxValue;
//double bpmMost = 60000/ beatmap.Beatmap.ControlPoints.Select(b => b.BeatLength).GroupBy(bl => bl).OrderByDescending(grp => grp.Count()).Select(grp => grp.Key).First();
double bpmMost = beatmap.Beatmap.BPMAt(beatmap.Beatmap.ControlPoints.GroupBy(b => b.BeatLength).OrderByDescending(grp => grp.Count()).First().First().Time);
foreach (ControlPoint a in beatmap.Beatmap.ControlPoints) foreach (ControlPoint a in beatmap.Beatmap.ControlPoints)
{ {
if (a.BeatLength == 0) continue; if (a.BeatLength == 0) continue;
double tmp = 60000 / a.BeatLength; double tmp = beatmap.Beatmap.BPMAt(a.Time);
if (bpmMax < tmp) bpmMax = tmp; if (bpmMax < tmp) bpmMax = tmp;
if (bpmMin > tmp) bpmMin = tmp; if (bpmMin > tmp) bpmMin = tmp;
} }
if (bpmMax == bpmMin) return (int)bpmMin + "bpm"; if (bpmMax == bpmMin) return Math.Round(bpmMin) + "bpm";
return (int)bpmMin + "-" + (int)bpmMax + "(" + (int)beatmap.Beatmap.BPMAt(beatmap.Beatmap.Metadata.PreviewTime) + ")bpm"; return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "(" + Math.Round(bpmMost) + ")bpm";
} }
private Container InfoLabel(FontAwesome icon, string text) private Container InfoLabel(FontAwesome icon, string text)