1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 11:43:22 +08:00

Fix usages of IDifficultyAttributes

This commit is contained in:
minisbett 2024-11-17 20:45:16 +01:00
parent ae25f27785
commit d7ae4a0775
No known key found for this signature in database
GPG Key ID: 2DB6D529C95A0403
6 changed files with 27 additions and 5 deletions

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.EmptyFreeform
protected override IDifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
return new IDifficultyAttributes(mods, 0);
return new EmptyDifficultyAttributes();
}
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty<DifficultyHitObject>();

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Pippidon
protected override IDifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
return new IDifficultyAttributes(mods, 0);
return new EmptyDifficultyAttributes();
}
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty<DifficultyHitObject>();

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.EmptyScrolling
protected override IDifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
return new IDifficultyAttributes(mods, 0);
return new EmptyDifficultyAttributes();
}
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty<DifficultyHitObject>();

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Pippidon
protected override IDifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
return new IDifficultyAttributes(mods, 0);
return new EmptyDifficultyAttributes();
}
protected override IEnumerable<DifficultyHitObject> CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) => Enumerable.Empty<DifficultyHitObject>();

View File

@ -208,7 +208,7 @@ namespace osu.Game.Tests.NonVisual
}
}
private class TestDifficultyAttributes : IDifficultyAttributes
private class TestDifficultyAttributes : EmptyDifficultyAttributes
{
public HitObject[] Objects = Array.Empty<HitObject>();
}

View File

@ -55,4 +55,26 @@ namespace osu.Game.Rulesets.Difficulty
/// <param name="onlineInfo">The <see cref="IBeatmapOnlineInfo"/> where more information about the beatmap may be extracted from (such as AR/CS/OD/etc).</param>
public void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values, IBeatmapOnlineInfo onlineInfo);
}
/// <summary>
/// Represents a full, minimal implementation of <see cref="IDifficultyAttributes"/>.
/// </summary>
public class EmptyDifficultyAttributes : IDifficultyAttributes
{
public double StarRating { get; set; }
public int MaxCombo { get; set; }
public IEnumerable<(int attributeId, object value)> ToDatabaseAttributes()
{
yield return (IDifficultyAttributes.ATTRIB_ID_MAX_COMBO, MaxCombo);
yield return (IDifficultyAttributes.ATTRIB_ID_AIM, StarRating);
}
public void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values, IBeatmapOnlineInfo onlineInfo)
{
MaxCombo = (int)values[IDifficultyAttributes.ATTRIB_ID_MAX_COMBO];
StarRating = values[IDifficultyAttributes.ATTRIB_ID_AIM];
}
}
}