Skip to content

Commit

Permalink
Merge pull request #30802 from cloudrac3r/patch-1
Browse files Browse the repository at this point in the history
Use consistent decimal places in BeatmapAttributeText
  • Loading branch information
bdach authored Nov 21, 2024
2 parents 2eef920 + 74170ea commit 23ef8fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ public void Setup() => Schedule(() =>
});
});

[TestCase(BeatmapAttribute.CircleSize, "Circle Size: 1.00")]
[TestCase(BeatmapAttribute.HPDrain, "HP Drain: 2.00")]
[TestCase(BeatmapAttribute.Accuracy, "Accuracy: 3.00")]
[TestCase(BeatmapAttribute.ApproachRate, "Approach Rate: 4.00")]
[TestCase(BeatmapAttribute.CircleSize, "Circle Size: 1")]
[TestCase(BeatmapAttribute.HPDrain, "HP Drain: 2")]
[TestCase(BeatmapAttribute.Accuracy, "Accuracy: 3")]
[TestCase(BeatmapAttribute.ApproachRate, "Approach Rate: 4")]
[TestCase(BeatmapAttribute.Title, "Title: _Title")]
[TestCase(BeatmapAttribute.Artist, "Artist: _Artist")]
[TestCase(BeatmapAttribute.Creator, "Creator: _Creator")]
Expand Down Expand Up @@ -121,15 +121,15 @@ public void TestWithMods()
Difficulty =
{
ApproachRate = 10,
CircleSize = 9
CircleSize = 9.5f
}
}
}));

test(BeatmapAttribute.BPM, new OsuModDoubleTime(), "BPM: 100.00", "BPM: 150.00");
test(BeatmapAttribute.BPM, new OsuModDoubleTime(), "BPM: 100", "BPM: 150");
test(BeatmapAttribute.Length, new OsuModDoubleTime(), "Length: 00:30", "Length: 00:20");
test(BeatmapAttribute.ApproachRate, new OsuModDoubleTime(), "Approach Rate: 10.00", "Approach Rate: 11.00");
test(BeatmapAttribute.CircleSize, new OsuModHardRock(), "Circle Size: 9.00", "Circle Size: 10.00");
test(BeatmapAttribute.ApproachRate, new OsuModDoubleTime(), "Approach Rate: 10", "Approach Rate: 11");
test(BeatmapAttribute.CircleSize, new OsuModHardRock(), "Circle Size: 9.5", "Circle Size: 10");

void test(BeatmapAttribute attribute, Mod mod, string before, string after)
{
Expand Down
10 changes: 5 additions & 5 deletions osu.Game/Skinning/Components/BeatmapAttributeText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,19 +211,19 @@ private LocalisableString getValueString(BeatmapAttribute attribute)
return beatmap.Value.BeatmapInfo.Status.GetLocalisableDescription();

case BeatmapAttribute.BPM:
return FormatUtils.RoundBPM(beatmap.Value.BeatmapInfo.BPM, ModUtils.CalculateRateWithMods(mods.Value)).ToLocalisableString(@"F2");
return FormatUtils.RoundBPM(beatmap.Value.BeatmapInfo.BPM, ModUtils.CalculateRateWithMods(mods.Value)).ToLocalisableString(@"0.##");

case BeatmapAttribute.CircleSize:
return computeDifficulty().CircleSize.ToLocalisableString(@"F2");
return computeDifficulty().CircleSize.ToLocalisableString(@"0.##");

case BeatmapAttribute.HPDrain:
return computeDifficulty().DrainRate.ToLocalisableString(@"F2");
return computeDifficulty().DrainRate.ToLocalisableString(@"0.##");

case BeatmapAttribute.Accuracy:
return computeDifficulty().OverallDifficulty.ToLocalisableString(@"F2");
return computeDifficulty().OverallDifficulty.ToLocalisableString(@"0.##");

case BeatmapAttribute.ApproachRate:
return computeDifficulty().ApproachRate.ToLocalisableString(@"F2");
return computeDifficulty().ApproachRate.ToLocalisableString(@"0.##");

case BeatmapAttribute.StarRating:
return (starDifficulty?.Stars ?? 0).ToLocalisableString(@"F2");
Expand Down

0 comments on commit 23ef8fd

Please sign in to comment.