Only calculate difficulties on import for now.

This commit is contained in:
Dean Herbert 2017-03-17 11:53:13 +09:00
parent 9c664e5b05
commit cd98af29c4
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
5 changed files with 5 additions and 14 deletions

View File

@ -63,8 +63,6 @@ namespace osu.Game.Beatmaps.Drawables
{
BeatmapSet = beatmapSet;
WorkingBeatmap beatmap = database.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault());
foreach (var b in BeatmapSet.Beatmaps)
b.StarDifficulty = (float)(database.GetWorkingBeatmap(b).Beatmap?.CalculateStarDifficulty() ?? -1f);
Header = new BeatmapSetHeader(beatmap)
{

View File

@ -138,7 +138,7 @@ namespace osu.Game.Beatmaps.Drawables
},
starCounter = new StarCounter
{
Count = beatmap.StarDifficulty,
Count = (float)beatmap.StarDifficulty,
Scale = new Vector2(0.8f),
}
}

View File

@ -236,6 +236,8 @@ namespace osu.Game.Database
// TODO: Diff beatmap metadata with set metadata and leave it here if necessary
beatmap.BeatmapInfo.Metadata = null;
beatmap.BeatmapInfo.StarDifficulty = beatmap.CalculateStarDifficulty();
beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
}
beatmapSet.StoryboardFile = archive.StoryboardFilename;

View File

@ -75,16 +75,7 @@ namespace osu.Game.Database
// Metadata
public string Version { get; set; }
private float starDifficulty = -1;
public float StarDifficulty
{
get
{
return starDifficulty < 0 ? (Difficulty?.OverallDifficulty ?? 5) : starDifficulty;
}
set { starDifficulty = value; }
}
public double StarDifficulty { get; set; }
public bool Equals(BeatmapInfo other)
{

View File

@ -24,7 +24,7 @@ namespace osu.Game.Database
[OneToMany(CascadeOperations = CascadeOperation.All)]
public List<BeatmapInfo> Beatmaps { get; set; }
public float MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty);
public double MaxStarDifficulty => Beatmaps.Max(b => b.StarDifficulty);
public bool DeletePending { get; set; }