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:
parent
ae25f27785
commit
d7ae4a0775
@ -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>();
|
||||
|
@ -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>();
|
||||
|
@ -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>();
|
||||
|
@ -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>();
|
||||
|
@ -208,7 +208,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
}
|
||||
}
|
||||
|
||||
private class TestDifficultyAttributes : IDifficultyAttributes
|
||||
private class TestDifficultyAttributes : EmptyDifficultyAttributes
|
||||
{
|
||||
public HitObject[] Objects = Array.Empty<HitObject>();
|
||||
}
|
||||
|
@ -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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user