mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 12:17:46 +08:00
Move load methods and rename loadedTrack
to match other private fields
This commit is contained in:
parent
7344c87b16
commit
a5f77a86ef
@ -41,6 +41,7 @@ namespace osu.Game.Beatmaps
|
|||||||
private readonly Lazy<Waveform> waveform;
|
private readonly Lazy<Waveform> waveform;
|
||||||
private readonly Lazy<Storyboard> storyboard;
|
private readonly Lazy<Storyboard> storyboard;
|
||||||
private readonly Lazy<ISkin> skin;
|
private readonly Lazy<ISkin> skin;
|
||||||
|
private Track track; // track is not Lazy as we allow transferring and loading multiple times.
|
||||||
|
|
||||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
|
protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
|
||||||
{
|
{
|
||||||
@ -59,13 +60,6 @@ namespace osu.Game.Beatmaps
|
|||||||
public Texture Background => GetBackground(); // Texture uses ref counting, so we want to return a new instance every usage.
|
public Texture Background => GetBackground(); // Texture uses ref counting, so we want to return a new instance every usage.
|
||||||
public ISkin Skin => skin.Value;
|
public ISkin Skin => skin.Value;
|
||||||
|
|
||||||
#region Load checks
|
|
||||||
|
|
||||||
public virtual bool TrackLoaded => loadedTrack != null;
|
|
||||||
public virtual bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Resource getters
|
#region Resource getters
|
||||||
|
|
||||||
protected virtual Waveform GetWaveform() => new Waveform(null);
|
protected virtual Waveform GetWaveform() => new Waveform(null);
|
||||||
@ -107,9 +101,9 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
#region Track
|
#region Track
|
||||||
|
|
||||||
private Track loadedTrack;
|
public virtual bool TrackLoaded => track != null;
|
||||||
|
|
||||||
public Track LoadTrack() => loadedTrack = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
public Track LoadTrack() => track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
||||||
|
|
||||||
public void PrepareTrackForPreviewLooping()
|
public void PrepareTrackForPreviewLooping()
|
||||||
{
|
{
|
||||||
@ -133,7 +127,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// across difficulties in the same beatmap set.
|
/// across difficulties in the same beatmap set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="track">The track to transfer.</param>
|
/// <param name="track">The track to transfer.</param>
|
||||||
public void TransferTrack([NotNull] Track track) => loadedTrack = track ?? throw new ArgumentNullException(nameof(track));
|
public void TransferTrack([NotNull] Track track) => this.track = track ?? throw new ArgumentNullException(nameof(track));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get the loaded audio track instance. <see cref="LoadTrack"/> must have first been called.
|
/// Get the loaded audio track instance. <see cref="LoadTrack"/> must have first been called.
|
||||||
@ -146,7 +140,7 @@ namespace osu.Game.Beatmaps
|
|||||||
if (!TrackLoaded)
|
if (!TrackLoaded)
|
||||||
throw new InvalidOperationException($"Cannot access {nameof(Track)} without first calling {nameof(LoadTrack)}.");
|
throw new InvalidOperationException($"Cannot access {nameof(Track)} without first calling {nameof(LoadTrack)}.");
|
||||||
|
|
||||||
return loadedTrack;
|
return track;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,6 +174,8 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
#region Beatmap
|
#region Beatmap
|
||||||
|
|
||||||
|
public virtual bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false;
|
||||||
|
|
||||||
public IBeatmap Beatmap
|
public IBeatmap Beatmap
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
Loading…
Reference in New Issue
Block a user