Make categoryDifficulties return doubles to improve decimal accuracy

This commit is contained in:
smoogipoo
2017-11-21 19:54:53 +09:00
parent decee415dd
commit f9ad4b6acb
8 changed files with 22 additions and 21 deletions

View File

@ -14,7 +14,7 @@ namespace osu.Game.Beatmaps
{
protected double TimeRate = 1;
public abstract double Calculate(Dictionary<string, string> categoryDifficulty = null);
public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null);
}
public abstract class DifficultyCalculator<T> : DifficultyCalculator where T : HitObject

View File

@ -9,14 +9,14 @@ namespace osu.Game.Rulesets.Scoring
{
public abstract class PerformanceCalculator
{
public abstract double Calculate(Dictionary<string, string> categoryDifficulty = null);
public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null);
}
public abstract class PerformanceCalculator<TObject> : PerformanceCalculator
where TObject : HitObject
{
private readonly Dictionary<string, string> attributes = new Dictionary<string, string>();
protected IDictionary<string, string> Attributes => attributes;
private readonly Dictionary<string, double> attributes = new Dictionary<string, double>();
protected IDictionary<string, double> Attributes => attributes;
protected readonly Beatmap<TObject> Beatmap;
protected readonly Score Score;

View File

@ -259,7 +259,7 @@ namespace osu.Game.Tests.Visual
if (calculator == null)
return;
var attributes = new Dictionary<string, string>();
var attributes = new Dictionary<string, double>();
double performance = calculator.Calculate(attributes);
text.Text = $"{score.User.Username} -> online: {score.PP:n2}pp | local: {performance:n2}pp";
@ -364,12 +364,12 @@ namespace osu.Game.Tests.Visual
var diffCalc = ruleset.CreateDifficultyCalculator(beatmap.Beatmap, activeMods);
if (diffCalc != null)
{
var categories = new Dictionary<string, string>();
var categories = new Dictionary<string, double>();
double totalSr = diffCalc.Calculate(categories);
totalText.Text = $"Star rating: {totalSr:n2}";
foreach (var kvp in categories)
categoryTexts.Add(new OsuSpriteText { Text = $"{kvp.Key}: {kvp.Value}" });
categoryTexts.Add(new OsuSpriteText { Text = $"{kvp.Key}: {kvp.Value:n2}" });
}
informationCache.Validate();