mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 19:32:55 +08:00
Use static method, add xmldoc + link to wiki
This commit is contained in:
parent
2213db2088
commit
62b55c4c9c
@ -114,6 +114,25 @@ namespace osu.Game.Beatmaps
|
|||||||
return computeDifficulty(key, beatmapInfo, rulesetInfo);
|
return computeDifficulty(key, beatmapInfo, rulesetInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the <see cref="DifficultyRating"/> that describes a star rating.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// For more information, see: https://osu.ppy.sh/help/wiki/Difficulties
|
||||||
|
/// </remarks>
|
||||||
|
/// <param name="starRating">The star rating.</param>
|
||||||
|
/// <returns>The <see cref="DifficultyRating"/> that best describes <paramref name="starRating"/>.</returns>
|
||||||
|
public static DifficultyRating GetDifficultyRating(double starRating)
|
||||||
|
{
|
||||||
|
if (starRating < 2.0) return DifficultyRating.Easy;
|
||||||
|
if (starRating < 2.7) return DifficultyRating.Normal;
|
||||||
|
if (starRating < 4.0) return DifficultyRating.Hard;
|
||||||
|
if (starRating < 5.3) return DifficultyRating.Insane;
|
||||||
|
if (starRating < 6.5) return DifficultyRating.Expert;
|
||||||
|
|
||||||
|
return DifficultyRating.ExpertPlus;
|
||||||
|
}
|
||||||
|
|
||||||
private CancellationTokenSource trackedUpdateCancellationSource;
|
private CancellationTokenSource trackedUpdateCancellationSource;
|
||||||
private readonly List<CancellationTokenSource> linkedCancellationSources = new List<CancellationTokenSource>();
|
private readonly List<CancellationTokenSource> linkedCancellationSources = new List<CancellationTokenSource>();
|
||||||
|
|
||||||
@ -308,18 +327,6 @@ namespace osu.Game.Beatmaps
|
|||||||
// Todo: Add more members (BeatmapInfo.DifficultyRating? Attributes? Etc...)
|
// Todo: Add more members (BeatmapInfo.DifficultyRating? Attributes? Etc...)
|
||||||
}
|
}
|
||||||
|
|
||||||
public DifficultyRating DifficultyRating
|
public DifficultyRating DifficultyRating => BeatmapDifficultyManager.GetDifficultyRating(Stars);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (Stars < 2.0) return DifficultyRating.Easy;
|
|
||||||
if (Stars < 2.7) return DifficultyRating.Normal;
|
|
||||||
if (Stars < 4.0) return DifficultyRating.Hard;
|
|
||||||
if (Stars < 5.3) return DifficultyRating.Insane;
|
|
||||||
if (Stars < 6.5) return DifficultyRating.Expert;
|
|
||||||
|
|
||||||
return DifficultyRating.ExpertPlus;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,21 +135,7 @@ namespace osu.Game.Beatmaps
|
|||||||
public List<ScoreInfo> Scores { get; set; }
|
public List<ScoreInfo> Scores { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public DifficultyRating DifficultyRating
|
public DifficultyRating DifficultyRating => BeatmapDifficultyManager.GetDifficultyRating(StarDifficulty);
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
var rating = StarDifficulty;
|
|
||||||
|
|
||||||
if (rating < 2.0) return DifficultyRating.Easy;
|
|
||||||
if (rating < 2.7) return DifficultyRating.Normal;
|
|
||||||
if (rating < 4.0) return DifficultyRating.Hard;
|
|
||||||
if (rating < 5.3) return DifficultyRating.Insane;
|
|
||||||
if (rating < 6.5) return DifficultyRating.Expert;
|
|
||||||
|
|
||||||
return DifficultyRating.ExpertPlus;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string[] SearchableTerms => new[]
|
public string[] SearchableTerms => new[]
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user