mirror of
https://github.com/ppy/osu
synced 2025-01-22 05:43:14 +00:00
Split ctors to avoid passing fields one by one
This commit is contained in:
parent
e845cc92b8
commit
779e6e10a7
@ -227,7 +227,7 @@ namespace osu.Game.Beatmaps
|
|||||||
var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(beatmapInfo));
|
var calculator = ruleset.CreateDifficultyCalculator(beatmapManager.GetWorkingBeatmap(beatmapInfo));
|
||||||
var attributes = calculator.Calculate(key.Mods);
|
var attributes = calculator.Calculate(key.Mods);
|
||||||
|
|
||||||
return difficultyCache[key] = new StarDifficulty(attributes.StarRating, attributes.MaxCombo, attributes);
|
return difficultyCache[key] = new StarDifficulty(attributes);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -322,14 +322,21 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public readonly DifficultyAttributes Attributes;
|
public readonly DifficultyAttributes Attributes;
|
||||||
|
|
||||||
public StarDifficulty(double stars, int maxCombo, DifficultyAttributes attributes = null)
|
public StarDifficulty([NotNull] DifficultyAttributes attributes)
|
||||||
{
|
{
|
||||||
Stars = stars;
|
Stars = attributes.StarRating;
|
||||||
MaxCombo = maxCombo;
|
MaxCombo = attributes.MaxCombo;
|
||||||
Attributes = attributes;
|
Attributes = attributes;
|
||||||
// Todo: Add more members (BeatmapInfo.DifficultyRating? Attributes? Etc...)
|
// Todo: Add more members (BeatmapInfo.DifficultyRating? Attributes? Etc...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public StarDifficulty(double starDifficulty, int maxCombo)
|
||||||
|
{
|
||||||
|
Stars = starDifficulty;
|
||||||
|
MaxCombo = maxCombo;
|
||||||
|
Attributes = null;
|
||||||
|
}
|
||||||
|
|
||||||
public DifficultyRating DifficultyRating => BeatmapDifficultyManager.GetDifficultyRating(Stars);
|
public DifficultyRating DifficultyRating => BeatmapDifficultyManager.GetDifficultyRating(Stars);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user