Expose more of WorkingBeatmap via interface

This commit is contained in:
Dean Herbert
2021-11-15 18:24:00 +09:00
parent da75329f0c
commit a0e25d18cd
2 changed files with 66 additions and 20 deletions

View File

@ -28,8 +28,10 @@ namespace osu.Game.Beatmaps
{
public readonly BeatmapInfo BeatmapInfo;
// ReSharper disable once FieldHidesInterfacePropertyWithDefaultImplementation
public readonly BeatmapSetInfo BeatmapSetInfo;
// ReSharper disable once FieldHidesInterfacePropertyWithDefaultImplementation
public readonly BeatmapMetadata Metadata;
protected AudioManager AudioManager { get; }
@ -89,6 +91,9 @@ namespace osu.Game.Beatmaps
var rulesetInstance = ruleset.CreateInstance();
if (rulesetInstance == null)
throw new RulesetLoadException("Creating ruleset instance failed when attempting to create playable beatmap.");
IBeatmapConverter converter = CreateBeatmapConverter(Beatmap, rulesetInstance);
// Check if the beatmap can be converted
@ -176,17 +181,8 @@ namespace osu.Game.Beatmaps
private CancellationTokenSource loadCancellation = new CancellationTokenSource();
/// <summary>
/// Beings loading the contents of this <see cref="WorkingBeatmap"/> asynchronously.
/// </summary>
public void BeginAsyncLoad()
{
loadBeatmapAsync();
}
public void BeginAsyncLoad() => loadBeatmapAsync();
/// <summary>
/// Cancels the asynchronous loading of the contents of this <see cref="WorkingBeatmap"/>.
/// </summary>
public void CancelAsyncLoad()
{
lock (beatmapFetchLock)
@ -234,6 +230,8 @@ namespace osu.Game.Beatmaps
public virtual bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false;
IBeatmapInfo IWorkingBeatmap.BeatmapInfo => BeatmapInfo;
public IBeatmap Beatmap
{
get
@ -273,9 +271,6 @@ namespace osu.Game.Beatmaps
[NotNull]
public Track LoadTrack() => loadedTrack = GetBeatmapTrack() ?? GetVirtualTrack(1000);
/// <summary>
/// Reads the correct track restart point from beatmap metadata and sets looping to enabled.
/// </summary>
public void PrepareTrackForPreviewLooping()
{
Track.Looping = true;