1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:07:52 +08:00

Rename BeatmapInfo.StarDifficulty to StarRating to match underlying interface

This commit is contained in:
Dean Herbert 2021-11-11 17:18:51 +09:00
parent 374d1cc241
commit ebe58cee11
16 changed files with 30 additions and 32 deletions

View File

@ -17,7 +17,7 @@ namespace osu.Game.Tests.NonVisual.Filtering
private BeatmapInfo getExampleBeatmap() => new BeatmapInfo
{
Ruleset = new RulesetInfo { ID = 5 },
StarDifficulty = 4.0d,
StarRating = 4.0d,
BaseDifficulty = new BeatmapDifficulty
{
ApproachRate = 5.0f,

View File

@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
BeatmapInfo =
{
StarDifficulty = 2.5
StarRating = 2.5
}
}.BeatmapInfo,
}
@ -82,7 +82,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
BeatmapInfo =
{
StarDifficulty = 2.5,
StarRating = 2.5,
Metadata =
{
Artist = "very very very very very very very very very long artist",
@ -111,7 +111,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
BeatmapInfo =
{
StarDifficulty = 2.5
StarRating = 2.5
}
}.BeatmapInfo,
}
@ -124,7 +124,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
BeatmapInfo =
{
StarDifficulty = 4.5
StarRating = 4.5
}
}.BeatmapInfo,
}

View File

@ -31,8 +31,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
SelectedRoom.Value.Playlist.AddRange(new[]
{
new PlaylistItem { Beatmap = { Value = new BeatmapInfo { StarDifficulty = min } } },
new PlaylistItem { Beatmap = { Value = new BeatmapInfo { StarDifficulty = max } } },
new PlaylistItem { Beatmap = { Value = new BeatmapInfo { StarRating = min } } },
new PlaylistItem { Beatmap = { Value = new BeatmapInfo { StarRating = max } } },
});
});
}

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.SongSelect
OverallDifficulty = 5.7f,
ApproachRate = 3.5f
},
StarDifficulty = 4.5f
StarRating = 4.5f
};
[Test]
@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.SongSelect
OverallDifficulty = 4.5f,
ApproachRate = 3.1f
},
StarDifficulty = 8
StarRating = 8
});
AddAssert("first bar text is Key Count", () => advancedStats.ChildrenOfType<SpriteText>().First().Text == "Key Count");

View File

@ -435,8 +435,8 @@ namespace osu.Game.Tests.Visual.SongSelect
for (int i = 0; i < 3; i++)
{
var set = createTestBeatmapSet(i);
set.Beatmaps[0].StarDifficulty = 3 - i;
set.Beatmaps[2].StarDifficulty = 6 + i;
set.Beatmaps[0].StarRating = 3 - i;
set.Beatmaps[2].StarRating = 6 + i;
sets.Add(set);
}
@ -686,7 +686,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
Version = $"Stars: {i}",
Ruleset = new OsuRuleset().RulesetInfo,
StarDifficulty = i,
StarRating = i,
});
}
@ -869,7 +869,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
OnlineBeatmapID = id++ * 10,
Version = version,
StarDifficulty = diff,
StarRating = diff,
Ruleset = new OsuRuleset().RulesetInfo,
BaseDifficulty = new BeatmapDifficulty
{
@ -904,7 +904,7 @@ namespace osu.Game.Tests.Visual.SongSelect
Path = $"extra{b}.osu",
Version = $"Extra {b}",
Ruleset = rulesets.GetRuleset((b - 1) % 4),
StarDifficulty = 2,
StarRating = 2,
BaseDifficulty = new BeatmapDifficulty
{
OverallDifficulty = 3.5f,

View File

@ -198,7 +198,7 @@ namespace osu.Game.Tests.Visual.SongSelect
Title = $"{ruleset.ShortName}Title"
},
Ruleset = ruleset,
StarDifficulty = 6,
StarRating = 6,
Version = $"{ruleset.ShortName}Version",
BaseDifficulty = new BeatmapDifficulty()
},

View File

@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.SongSelect
Title = title,
},
Version = version,
StarDifficulty = RNG.NextDouble(0, 10),
StarRating = RNG.NextDouble(0, 10),
}
}));
}
@ -65,7 +65,7 @@ namespace osu.Game.Tests.Visual.SongSelect
Title = "Heavy beatmap",
},
Version = "10k objects",
StarDifficulty = 99.99f,
StarRating = 99.99f,
}
}));

View File

@ -188,7 +188,7 @@ namespace osu.Game.Tests.Visual.SongSelect
Metadata = metadata,
BaseDifficulty = new BeatmapDifficulty(),
Ruleset = ruleset,
StarDifficulty = difficultyIndex + 1,
StarRating = difficultyIndex + 1,
Version = $"SR{difficultyIndex + 1}"
}).ToList()
};

View File

@ -139,7 +139,8 @@ namespace osu.Game.Beatmaps
private string versionString => string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]";
[JsonProperty("difficulty_rating")]
public double StarDifficulty { get; set; }
[Column("StarDifficulty")]
public double StarRating { get; set; }
/// <summary>
/// Currently only populated for beatmap deletion. Use <see cref="ScoreManager"/> to query scores.
@ -147,7 +148,7 @@ namespace osu.Game.Beatmaps
public List<ScoreInfo> Scores { get; set; }
[JsonIgnore]
public DifficultyRating DifficultyRating => BeatmapDifficultyCache.GetDifficultyRating(StarDifficulty);
public DifficultyRating DifficultyRating => BeatmapDifficultyCache.GetDifficultyRating(StarRating);
public override string ToString() => this.GetDisplayTitle();
@ -197,9 +198,6 @@ namespace osu.Game.Beatmaps
[JsonIgnore]
IRulesetInfo IBeatmapInfo.Ruleset => Ruleset;
[JsonIgnore]
double IBeatmapInfo.StarRating => StarDifficulty;
#endregion
}
}

View File

@ -407,7 +407,7 @@ namespace osu.Game.Beatmaps
beatmap.BeatmapInfo.Ruleset = ruleset;
// TODO: this should be done in a better place once we actually need to dynamically update it.
beatmap.BeatmapInfo.StarDifficulty = ruleset?.CreateInstance().CreateDifficultyCalculator(new DummyConversionBeatmap(beatmap)).Calculate().StarRating ?? 0;
beatmap.BeatmapInfo.StarRating = ruleset?.CreateInstance().CreateDifficultyCalculator(new DummyConversionBeatmap(beatmap)).Calculate().StarRating ?? 0;
beatmap.BeatmapInfo.Length = calculateLength(beatmap);
beatmap.BeatmapInfo.BPM = 60000 / beatmap.GetMostCommonBeatLength();

View File

@ -38,7 +38,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// The maximum star difficulty of all beatmaps in this set.
/// </summary>
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarDifficulty) ?? 0;
public double MaxStarDifficulty => Beatmaps?.Max(b => b.StarRating) ?? 0;
/// <summary>
/// The maximum playable length in milliseconds of all beatmaps in this set.

View File

@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps
BeatmapInfo beatmapInfo = beatmaps.Where(b => b.Ruleset.Equals(r)).OrderBy(b =>
{
double difference = b.StarDifficulty - recommendation;
double difference = b.StarRating - recommendation;
return difference >= 0 ? difference * 2 : difference * -1; // prefer easier over harder
}).FirstOrDefault();

View File

@ -723,7 +723,7 @@ namespace osu.Game.Screens.Edit
if (difficultyItems.Count > 0)
difficultyItems.Add(new EditorMenuItemSpacer());
foreach (var beatmap in rulesetBeatmaps.OrderBy(b => b.StarDifficulty))
foreach (var beatmap in rulesetBeatmaps.OrderBy(b => b.StarRating))
difficultyItems.Add(createDifficultyMenuItem(beatmap));
}

View File

@ -38,7 +38,7 @@ namespace osu.Game.Screens.Select.Carousel
return;
}
match &= !criteria.StarDifficulty.HasFilter || criteria.StarDifficulty.IsInRange(BeatmapInfo.StarDifficulty);
match &= !criteria.StarDifficulty.HasFilter || criteria.StarDifficulty.IsInRange(BeatmapInfo.StarRating);
match &= !criteria.ApproachRate.HasFilter || criteria.ApproachRate.IsInRange(BeatmapInfo.BaseDifficulty.ApproachRate);
match &= !criteria.DrainRate.HasFilter || criteria.DrainRate.IsInRange(BeatmapInfo.BaseDifficulty.DrainRate);
match &= !criteria.CircleSize.HasFilter || criteria.CircleSize.IsInRange(BeatmapInfo.BaseDifficulty.CircleSize);
@ -53,7 +53,7 @@ namespace osu.Game.Screens.Select.Carousel
match &= !criteria.Artist.HasFilter || criteria.Artist.Matches(BeatmapInfo.Metadata.Artist) ||
criteria.Artist.Matches(BeatmapInfo.Metadata.ArtistUnicode);
match &= !criteria.UserStarDifficulty.HasFilter || criteria.UserStarDifficulty.IsInRange(BeatmapInfo.StarDifficulty);
match &= !criteria.UserStarDifficulty.HasFilter || criteria.UserStarDifficulty.IsInRange(BeatmapInfo.StarRating);
if (match)
{
@ -92,7 +92,7 @@ namespace osu.Game.Screens.Select.Carousel
int ruleset = BeatmapInfo.RulesetID.CompareTo(otherBeatmap.BeatmapInfo.RulesetID);
if (ruleset != 0) return ruleset;
return BeatmapInfo.StarDifficulty.CompareTo(otherBeatmap.BeatmapInfo.StarDifficulty);
return BeatmapInfo.StarRating.CompareTo(otherBeatmap.BeatmapInfo.StarRating);
}
}

View File

@ -84,7 +84,7 @@ namespace osu.Game.Screens.Select.Carousel
return compareUsingAggregateMax(otherSet, b => b.Length);
case SortMode.Difficulty:
return compareUsingAggregateMax(otherSet, b => b.StarDifficulty);
return compareUsingAggregateMax(otherSet, b => b.StarRating);
}
}

View File

@ -228,7 +228,7 @@ namespace osu.Game.Tests.Visual
Checksum = beatmap.MD5Hash,
AuthorID = beatmap.Metadata.Author.OnlineID,
RulesetID = beatmap.RulesetID,
StarRating = beatmap.StarDifficulty,
StarRating = beatmap.StarRating,
DifficultyName = beatmap.Version,
}
}