mirror of
https://github.com/ppy/osu
synced 2025-01-28 00:32:59 +00:00
Use consts for attribute IDs
This commit is contained in:
parent
43cbb23b15
commit
815179f713
@ -17,19 +17,19 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
||||
foreach (var v in base.ToDatabaseAttributes())
|
||||
yield return v;
|
||||
|
||||
// Todo: Catch should not output star rating in the 'aim' attribute.
|
||||
yield return (1, StarRating);
|
||||
yield return (7, ApproachRate);
|
||||
yield return (9, MaxCombo);
|
||||
// Todo: osu!catch should not output star rating in the 'aim' attribute.
|
||||
yield return (ATTRIB_ID_AIM, StarRating);
|
||||
yield return (ATTRIB_ID_APPROACH_RATE, ApproachRate);
|
||||
yield return (ATTRIB_ID_MAX_COMBO, MaxCombo);
|
||||
}
|
||||
|
||||
public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
|
||||
{
|
||||
base.FromDatabaseAttributes(values);
|
||||
|
||||
StarRating = values[1];
|
||||
ApproachRate = values[7];
|
||||
MaxCombo = (int)values[9];
|
||||
StarRating = values[ATTRIB_ID_AIM];
|
||||
ApproachRate = values[ATTRIB_ID_APPROACH_RATE];
|
||||
MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -20,19 +20,19 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
||||
foreach (var v in base.ToDatabaseAttributes())
|
||||
yield return v;
|
||||
|
||||
// Todo: Mania doesn't output MaxCombo attribute for some reason.
|
||||
yield return (11, StarRating);
|
||||
yield return (13, GreatHitWindow);
|
||||
yield return (15, ScoreMultiplier);
|
||||
// Todo: osu!mania doesn't output MaxCombo attribute for some reason.
|
||||
yield return (ATTRIB_ID_STRAIN, StarRating);
|
||||
yield return (ATTRIB_ID_GREAT_HIT_WINDOW, GreatHitWindow);
|
||||
yield return (ATTRIB_ID_SCORE_MULTIPLIER, ScoreMultiplier);
|
||||
}
|
||||
|
||||
public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
|
||||
{
|
||||
base.FromDatabaseAttributes(values);
|
||||
|
||||
StarRating = values[11];
|
||||
GreatHitWindow = values[13];
|
||||
ScoreMultiplier = values[15];
|
||||
StarRating = values[ATTRIB_ID_STRAIN];
|
||||
GreatHitWindow = values[ATTRIB_ID_GREAT_HIT_WINDOW];
|
||||
ScoreMultiplier = values[ATTRIB_ID_SCORE_MULTIPLIER];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -43,31 +43,31 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
||||
foreach (var v in base.ToDatabaseAttributes())
|
||||
yield return v;
|
||||
|
||||
yield return (1, AimStrain);
|
||||
yield return (3, SpeedStrain);
|
||||
yield return (5, OverallDifficulty);
|
||||
yield return (7, ApproachRate);
|
||||
yield return (9, MaxCombo);
|
||||
yield return (11, StarRating);
|
||||
yield return (ATTRIB_ID_AIM, AimStrain);
|
||||
yield return (ATTRIB_ID_SPEED, SpeedStrain);
|
||||
yield return (ATTRIB_ID_OVERALL_DIFFICULTY, OverallDifficulty);
|
||||
yield return (ATTRIB_ID_APPROACH_RATE, ApproachRate);
|
||||
yield return (ATTRIB_ID_MAX_COMBO, MaxCombo);
|
||||
yield return (ATTRIB_ID_STRAIN, StarRating);
|
||||
|
||||
if (ShouldSerializeFlashlightRating())
|
||||
yield return (17, FlashlightRating);
|
||||
yield return (ATTRIB_ID_FLASHLIGHT, FlashlightRating);
|
||||
|
||||
yield return (19, SliderFactor);
|
||||
yield return (ATTRIB_ID_SLIDER_FACTOR, SliderFactor);
|
||||
}
|
||||
|
||||
public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
|
||||
{
|
||||
base.FromDatabaseAttributes(values);
|
||||
|
||||
AimStrain = values[1];
|
||||
SpeedStrain = values[3];
|
||||
OverallDifficulty = values[5];
|
||||
ApproachRate = values[7];
|
||||
MaxCombo = (int)values[9];
|
||||
StarRating = values[11];
|
||||
FlashlightRating = values.GetValueOrDefault(17);
|
||||
SliderFactor = values[19];
|
||||
AimStrain = values[ATTRIB_ID_AIM];
|
||||
SpeedStrain = values[ATTRIB_ID_SPEED];
|
||||
OverallDifficulty = values[ATTRIB_ID_OVERALL_DIFFICULTY];
|
||||
ApproachRate = values[ATTRIB_ID_APPROACH_RATE];
|
||||
MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO];
|
||||
StarRating = values[ATTRIB_ID_STRAIN];
|
||||
FlashlightRating = values.GetValueOrDefault(ATTRIB_ID_FLASHLIGHT);
|
||||
SliderFactor = values[ATTRIB_ID_SLIDER_FACTOR];
|
||||
}
|
||||
|
||||
// Used implicitly by Newtonsoft.Json to not serialize flashlight property in some cases.
|
||||
|
@ -29,18 +29,18 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||
foreach (var v in base.ToDatabaseAttributes())
|
||||
yield return v;
|
||||
|
||||
yield return (9, MaxCombo);
|
||||
yield return (11, StarRating);
|
||||
yield return (13, GreatHitWindow);
|
||||
yield return (ATTRIB_ID_MAX_COMBO, MaxCombo);
|
||||
yield return (ATTRIB_ID_STRAIN, StarRating);
|
||||
yield return (ATTRIB_ID_GREAT_HIT_WINDOW, GreatHitWindow);
|
||||
}
|
||||
|
||||
public override void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
|
||||
{
|
||||
base.FromDatabaseAttributes(values);
|
||||
|
||||
MaxCombo = (int)values[9];
|
||||
StarRating = values[11];
|
||||
GreatHitWindow = values[13];
|
||||
MaxCombo = (int)values[ATTRIB_ID_MAX_COMBO];
|
||||
StarRating = values[ATTRIB_ID_STRAIN];
|
||||
GreatHitWindow = values[ATTRIB_ID_GREAT_HIT_WINDOW];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,5 +72,16 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
public virtual void FromDatabaseAttributes(IReadOnlyDictionary<int, double> values)
|
||||
{
|
||||
}
|
||||
|
||||
protected const int ATTRIB_ID_AIM = 1;
|
||||
protected const int ATTRIB_ID_SPEED = 3;
|
||||
protected const int ATTRIB_ID_OVERALL_DIFFICULTY = 5;
|
||||
protected const int ATTRIB_ID_APPROACH_RATE = 7;
|
||||
protected const int ATTRIB_ID_MAX_COMBO = 9;
|
||||
protected const int ATTRIB_ID_STRAIN = 11;
|
||||
protected const int ATTRIB_ID_GREAT_HIT_WINDOW = 13;
|
||||
protected const int ATTRIB_ID_SCORE_MULTIPLIER = 15;
|
||||
protected const int ATTRIB_ID_FLASHLIGHT = 17;
|
||||
protected const int ATTRIB_ID_SLIDER_FACTOR = 19;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user