Add difficulty calculation

Adds base classes for difficulty calculations, hooks them up with
carousel container, and adds a port of the osu difficulty calculator.
This commit is contained in:
Thomas Müller
2017-02-19 17:41:51 +01:00
parent 5721e7f2d2
commit 417f146386
29 changed files with 587 additions and 31 deletions

View File

@ -8,6 +8,7 @@ using osu.Game.Modes;
using osu.Game.Screens.Play;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes;
using osu.Game.Beatmaps;
namespace osu.Game.Database
{
@ -73,7 +74,23 @@ namespace osu.Game.Database
// Metadata
public string Version { get; set; }
public float StarDifficulty => BaseDifficulty?.OverallDifficulty ?? 5; //todo: implement properly
//todo: background threaded computation of this
private float starDifficulty = -1;
public float StarDifficulty
{
get
{
return (starDifficulty < 0) ? (BaseDifficulty?.OverallDifficulty ?? 5) : starDifficulty;
}
set { starDifficulty = value; }
}
internal void ComputeDifficulty(BeatmapDatabase database)
{
WorkingBeatmap wb = new WorkingBeatmap(this, BeatmapSet, database);
StarDifficulty = (float)Ruleset.GetRuleset(Mode).CreateDifficultyCalculator(wb.Beatmap).GetDifficulty();
}
public bool Equals(BeatmapInfo other)
{