mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Rename CancellationToken variable
This commit is contained in:
parent
cf0b757b16
commit
d5f5d74a89
@ -58,10 +58,10 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <param name="ruleset">The <see cref="RulesetInfo"/> to create a playable <see cref="IBeatmap"/> for.</param>
|
/// <param name="ruleset">The <see cref="RulesetInfo"/> to create a playable <see cref="IBeatmap"/> for.</param>
|
||||||
/// <param name="mods">The <see cref="Mod"/>s to apply to the <see cref="IBeatmap"/>.</param>
|
/// <param name="mods">The <see cref="Mod"/>s to apply to the <see cref="IBeatmap"/>.</param>
|
||||||
/// <param name="timeout">The maximum length in milliseconds to wait for load to complete. Defaults to 10,000ms.</param>
|
/// <param name="timeout">The maximum length in milliseconds to wait for load to complete. Defaults to 10,000ms.</param>
|
||||||
/// <param name="timeoutToken">Cancellation token that cancels the beatmap loading process.</param>
|
/// <param name="token">Cancellation token that cancels the beatmap loading process.</param>
|
||||||
/// <returns>The converted <see cref="IBeatmap"/>.</returns>
|
/// <returns>The converted <see cref="IBeatmap"/>.</returns>
|
||||||
/// <exception cref="BeatmapInvalidForRulesetException">If <see cref="Beatmap"/> could not be converted to <paramref name="ruleset"/>.</exception>
|
/// <exception cref="BeatmapInvalidForRulesetException">If <see cref="Beatmap"/> could not be converted to <paramref name="ruleset"/>.</exception>
|
||||||
IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods = null, TimeSpan? timeout = null, CancellationToken timeoutToken = default);
|
IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods = null, TimeSpan? timeout = null, CancellationToken token = default);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load a new audio track instance for this beatmap. This should be called once before accessing <see cref="Track"/>.
|
/// Load a new audio track instance for this beatmap. This should be called once before accessing <see cref="Track"/>.
|
||||||
|
@ -81,10 +81,10 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>The applicable <see cref="IBeatmapConverter"/>.</returns>
|
/// <returns>The applicable <see cref="IBeatmapConverter"/>.</returns>
|
||||||
protected virtual IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset) => ruleset.CreateBeatmapConverter(beatmap);
|
protected virtual IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset) => ruleset.CreateBeatmapConverter(beatmap);
|
||||||
|
|
||||||
public virtual IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods = null, TimeSpan? timeout = null, CancellationToken timeoutToken = default)
|
public virtual IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods = null, TimeSpan? timeout = null, CancellationToken token = default)
|
||||||
{
|
{
|
||||||
using (var timeoutSource = createTimeoutTokenSource(timeout))
|
using (var timeoutSource = createTimeoutTokenSource(timeout))
|
||||||
using (var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(timeoutToken, timeoutSource.Token))
|
using (var linkedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, timeoutSource.Token))
|
||||||
{
|
{
|
||||||
mods ??= Array.Empty<Mod>();
|
mods ??= Array.Empty<Mod>();
|
||||||
|
|
||||||
|
@ -123,12 +123,12 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
/// Performs required tasks before every calculation.
|
/// Performs required tasks before every calculation.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mods">The original list of <see cref="Mod"/>s.</param>
|
/// <param name="mods">The original list of <see cref="Mod"/>s.</param>
|
||||||
/// <param name="cancellationToken">The cancellation timeoutToken.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
private void preProcess(IEnumerable<Mod> mods = null, CancellationToken cancellationToken = default)
|
private void preProcess(IEnumerable<Mod> mods = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
playableMods = mods.Select(m => m.DeepClone()).ToArray();
|
playableMods = mods.Select(m => m.DeepClone()).ToArray();
|
||||||
|
|
||||||
Beatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo, playableMods, timeoutToken: cancellationToken);
|
Beatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo, playableMods, token: cancellationToken);
|
||||||
|
|
||||||
var track = new TrackVirtual(10000);
|
var track = new TrackVirtual(10000);
|
||||||
playableMods.OfType<IApplicableToTrack>().ForEach(m => m.ApplyToTrack(track));
|
playableMods.OfType<IApplicableToTrack>().ForEach(m => m.ApplyToTrack(track));
|
||||||
|
Loading…
Reference in New Issue
Block a user