1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:43:05 +08:00

Remove extra members from FromDatabaseAttributes

This commit is contained in:
Dan Balasescu 2021-11-15 18:11:07 +09:00
parent 21c0882b74
commit c8a01c35f7
5 changed files with 18 additions and 20 deletions

View File

@ -12,9 +12,9 @@ namespace osu.Game.Rulesets.Catch.Difficulty
[JsonProperty("approach_rate")]
public double ApproachRate { get; set; }
public override IEnumerable<(int attributeId, object value)> ToDatabase()
public override IEnumerable<(int attributeId, object value)> ToDatabaseAttributes()
{
foreach (var v in base.ToDatabase())
foreach (var v in base.ToDatabaseAttributes())
yield return v;
// Todo: Catch should not output star rating in the 'aim' attribute.
@ -23,9 +23,9 @@ namespace osu.Game.Rulesets.Catch.Difficulty
yield return (9, MaxCombo);
}
public override void FromDatabase(IReadOnlyDictionary<int, double> values, int hitCircleCount, int spinnerCount)
public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
{
base.FromDatabase(values, hitCircleCount, spinnerCount);
base.FromDatabaseAttributes(values);
StarRating = values[1];
ApproachRate = values[7];

View File

@ -15,9 +15,9 @@ namespace osu.Game.Rulesets.Mania.Difficulty
[JsonProperty("score_multiplier")]
public double ScoreMultiplier { get; set; }
public override IEnumerable<(int attributeId, object value)> ToDatabase()
public override IEnumerable<(int attributeId, object value)> ToDatabaseAttributes()
{
foreach (var v in base.ToDatabase())
foreach (var v in base.ToDatabaseAttributes())
yield return v;
// Todo: Mania doesn't output MaxCombo attribute for some reason.
@ -26,9 +26,9 @@ namespace osu.Game.Rulesets.Mania.Difficulty
yield return (15, ScoreMultiplier);
}
public override void FromDatabase(IReadOnlyDictionary<int, double> values, int hitCircleCount, int spinnerCount)
public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
{
base.FromDatabase(values, hitCircleCount, spinnerCount);
base.FromDatabaseAttributes(values);
StarRating = values[11];
GreatHitWindow = values[13];

View File

@ -42,9 +42,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty
[JsonIgnore]
public int SpinnerCount { get; set; }
public override IEnumerable<(int attributeId, object value)> ToDatabase()
public override IEnumerable<(int attributeId, object value)> ToDatabaseAttributes()
{
foreach (var v in base.ToDatabase())
foreach (var v in base.ToDatabaseAttributes())
yield return v;
yield return (1, AimStrain);
@ -60,9 +60,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty
yield return (19, SliderFactor);
}
public override void FromDatabase(IReadOnlyDictionary<int, double> values, int hitCircleCount, int spinnerCount)
public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
{
base.FromDatabase(values, hitCircleCount, spinnerCount);
base.FromDatabaseAttributes(values);
AimStrain = values[1];
SpeedStrain = values[3];
@ -72,8 +72,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty
StarRating = values[11];
FlashlightRating = values.GetValueOrDefault(17);
SliderFactor = values[19];
HitCircleCount = hitCircleCount;
SpinnerCount = spinnerCount;
}
[UsedImplicitly]

View File

@ -24,9 +24,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
[JsonProperty("great_hit_window")]
public double GreatHitWindow { get; set; }
public override IEnumerable<(int attributeId, object value)> ToDatabase()
public override IEnumerable<(int attributeId, object value)> ToDatabaseAttributes()
{
foreach (var v in base.ToDatabase())
foreach (var v in base.ToDatabaseAttributes())
yield return v;
yield return (9, MaxCombo);
@ -34,9 +34,9 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
yield return (13, GreatHitWindow);
}
public override void FromDatabase(IReadOnlyDictionary<int, double> values, int hitCircleCount, int spinnerCount)
public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
{
base.FromDatabase(values, hitCircleCount, spinnerCount);
base.FromDatabaseAttributes(values);
MaxCombo = (int)values[9];
StarRating = values[11];

View File

@ -34,9 +34,9 @@ namespace osu.Game.Rulesets.Difficulty
StarRating = starRating;
}
public virtual IEnumerable<(int attributeId, object value)> ToDatabase() => Enumerable.Empty<(int, object)>();
public virtual IEnumerable<(int attributeId, object value)> ToDatabaseAttributes() => Enumerable.Empty<(int, object)>();
public virtual void FromDatabase(IReadOnlyDictionary<int, double> values, int hitCircleCount, int spinnerCount)
public virtual void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
{
}
}