1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 20:22:55 +08:00

Document base class

This commit is contained in:
Dan Balasescu 2021-11-17 20:20:54 +09:00
parent 2c45a327bb
commit abb333299b

View File

@ -9,23 +9,47 @@ using osu.Game.Rulesets.Mods;
namespace osu.Game.Rulesets.Difficulty namespace osu.Game.Rulesets.Difficulty
{ {
/// <summary>
/// Describes the difficulty of a beatmap, as output by a <see cref="DifficultyCalculator"/>.
/// </summary>
[JsonObject(MemberSerialization.OptIn)] [JsonObject(MemberSerialization.OptIn)]
public class DifficultyAttributes public class DifficultyAttributes
{ {
/// <summary>
/// The mods which were applied to the beatmap.
/// </summary>
public Mod[] Mods { get; set; } public Mod[] Mods { get; set; }
/// <summary>
/// The skills resulting from the difficulty calculation.
/// </summary>
public Skill[] Skills { get; set; } public Skill[] Skills { get; set; }
/// <summary>
/// The combined star rating of all skill.
/// </summary>
[JsonProperty("star_rating", Order = -3)] [JsonProperty("star_rating", Order = -3)]
public double StarRating { get; set; } public double StarRating { get; set; }
/// <summary>
/// The maximum achievable combo.
/// </summary>
[JsonProperty("max_combo", Order = -2)] [JsonProperty("max_combo", Order = -2)]
public int MaxCombo { get; set; } public int MaxCombo { get; set; }
/// <summary>
/// Creates new <see cref="DifficultyAttributes"/>.
/// </summary>
public DifficultyAttributes() public DifficultyAttributes()
{ {
} }
/// <summary>
/// Creates new <see cref="DifficultyAttributes"/>.
/// </summary>
/// <param name="mods">The mods which were applied to the beatmap.</param>
/// <param name="skills">The skills resulting from the difficulty calculation.</param>
/// <param name="starRating">The combined star rating of all skills.</param>
public DifficultyAttributes(Mod[] mods, Skill[] skills, double starRating) public DifficultyAttributes(Mod[] mods, Skill[] skills, double starRating)
{ {
Mods = mods; Mods = mods;
@ -33,8 +57,18 @@ namespace osu.Game.Rulesets.Difficulty
StarRating = starRating; StarRating = starRating;
} }
/// <summary>
/// Converts this <see cref="DifficultyAttributes"/> to osu-web compatible database attribute mappings.
/// </summary>
/// <remarks>
/// See: osu_difficulty_attribs table.
/// </remarks>
public virtual IEnumerable<(int attributeId, object value)> ToDatabaseAttributes() => Enumerable.Empty<(int, object)>(); public virtual IEnumerable<(int attributeId, object value)> ToDatabaseAttributes() => Enumerable.Empty<(int, object)>();
/// <summary>
/// Reads osu-web database attribute mappings into this <see cref="DifficultyAttributes"/> object.
/// </summary>
/// <param name="values">The attribute mappings.</param>
public virtual void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values) public virtual void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
{ {
} }