mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
Restore star difficulty calculation
This commit is contained in:
parent
268c14813b
commit
ad2c2a5fe6
@ -9,7 +9,9 @@ using System.Linq.Expressions;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
@ -341,9 +343,16 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
RulesetInfo ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID);
|
RulesetInfo ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID);
|
||||||
|
|
||||||
// TODO: this should be done in a better place once we actually need to dynamically update it.
|
|
||||||
beatmap.BeatmapInfo.Ruleset = ruleset;
|
beatmap.BeatmapInfo.Ruleset = ruleset;
|
||||||
beatmap.BeatmapInfo.StarDifficulty = ruleset?.CreateInstance()?.CreateDifficultyCalculator(beatmap).Calculate() ?? 0;
|
|
||||||
|
if (ruleset != null)
|
||||||
|
{
|
||||||
|
// TODO: this should be done in a better place once we actually need to dynamically update it.
|
||||||
|
var converted = new DummyConversionBeatmap(beatmap).GetPlayableBeatmap(ruleset);
|
||||||
|
beatmap.BeatmapInfo.StarDifficulty = ruleset.CreateInstance().CreateDifficultyCalculator(converted).Calculate();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
beatmap.BeatmapInfo.StarDifficulty = 0;
|
||||||
|
|
||||||
beatmapInfos.Add(beatmap.BeatmapInfo);
|
beatmapInfos.Add(beatmap.BeatmapInfo);
|
||||||
}
|
}
|
||||||
@ -351,5 +360,23 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
return beatmapInfos;
|
return beatmapInfos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A dummy WorkingBeatmap for the purpose of retrieving a beatmap for star difficulty calculation.
|
||||||
|
/// </summary>
|
||||||
|
private class DummyConversionBeatmap : WorkingBeatmap
|
||||||
|
{
|
||||||
|
private readonly IBeatmap beatmap;
|
||||||
|
|
||||||
|
public DummyConversionBeatmap(IBeatmap beatmap)
|
||||||
|
: base(beatmap.BeatmapInfo)
|
||||||
|
{
|
||||||
|
this.beatmap = beatmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IBeatmap GetBeatmap() => beatmap;
|
||||||
|
protected override Texture GetBackground() => null;
|
||||||
|
protected override Track GetTrack() => null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user