Merge branch 'master' into beatmap-difficulty-more-interface-usage

This commit is contained in:
Dan Balasescu
2021-10-06 12:18:51 +09:00
committed by GitHub
42 changed files with 737 additions and 139 deletions

View File

@ -17,6 +17,7 @@ using osu.Framework.Utils;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
@ -147,6 +148,14 @@ namespace osu.Game.Beatmaps
}, token, TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously, updateScheduler);
}
public Task<List<TimedDifficultyAttributes>> GetTimedDifficultyAttributesAsync(WorkingBeatmap beatmap, Ruleset ruleset, Mod[] mods, CancellationToken token = default)
{
return Task.Factory.StartNew(() => ruleset.CreateDifficultyCalculator(beatmap).CalculateTimed(mods),
token,
TaskCreationOptions.HideScheduler | TaskCreationOptions.RunContinuationsAsynchronously,
updateScheduler);
}
/// <summary>
/// Retrieves the <see cref="DifficultyRating"/> that describes a star rating.
/// </summary>

View File

@ -78,7 +78,7 @@ namespace osu.Game.Beatmaps
// intentionally blocking to limit web request concurrency
api.Perform(req);
var res = req.Result;
var res = req.Response;
if (res != null)
{

View File

@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// The beatmap set this beatmap is part of.
/// </summary>
IBeatmapSetInfo BeatmapSet { get; }
IBeatmapSetInfo? BeatmapSet { get; }
/// <summary>
/// The playable length in milliseconds of this beatmap.

View File

@ -81,7 +81,7 @@ namespace osu.Game.Beatmaps
/// <returns>The applicable <see cref="IBeatmapConverter"/>.</returns>
protected virtual IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset) => ruleset.CreateBeatmapConverter(beatmap);
public IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods = null, TimeSpan? timeout = null)
public virtual IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods = null, TimeSpan? timeout = null)
{
using (var cancellationSource = createCancellationTokenSource(timeout))
{