mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 02:17:46 +08:00
remove Storyboard from Beatmap, add it to WorkingBeatmap
This commit is contained in:
parent
cd653c1cbc
commit
96f5bd3323
@ -41,11 +41,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
|
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The Beatmap's Storyboard.
|
|
||||||
/// </summary>
|
|
||||||
public Storyboard Storyboard = new Storyboard();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Constructs a new beatmap.
|
/// Constructs a new beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -57,7 +52,6 @@ namespace osu.Game.Beatmaps
|
|||||||
Breaks = original?.Breaks ?? Breaks;
|
Breaks = original?.Breaks ?? Breaks;
|
||||||
ComboColors = original?.ComboColors ?? ComboColors;
|
ComboColors = original?.ComboColors ?? ComboColors;
|
||||||
HitObjects = original?.HitObjects ?? HitObjects;
|
HitObjects = original?.HitObjects ?? HitObjects;
|
||||||
Storyboard = original?.Storyboard ?? Storyboard;
|
|
||||||
|
|
||||||
if (original == null && Metadata == null)
|
if (original == null && Metadata == null)
|
||||||
{
|
{
|
||||||
|
@ -35,6 +35,7 @@ namespace osu.Game.Beatmaps
|
|||||||
background = new AsyncLazy<Texture>(populateBackground);
|
background = new AsyncLazy<Texture>(populateBackground);
|
||||||
track = new AsyncLazy<Track>(populateTrack);
|
track = new AsyncLazy<Track>(populateTrack);
|
||||||
waveform = new AsyncLazy<Waveform>(populateWaveform);
|
waveform = new AsyncLazy<Waveform>(populateWaveform);
|
||||||
|
storyboard = new AsyncLazy<Storyboard>(populateStoryboard);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract Beatmap GetBeatmap();
|
protected abstract Beatmap GetBeatmap();
|
||||||
@ -86,6 +87,13 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
private Waveform populateWaveform() => GetWaveform();
|
private Waveform populateWaveform() => GetWaveform();
|
||||||
|
|
||||||
|
public bool StoryboardLoaded => storyboard.IsValueCreated;
|
||||||
|
public Storyboard Storyboard => storyboard.Value.Result;
|
||||||
|
public async Task<Storyboard> GetStoryboardAsync() => await storyboard.Value;
|
||||||
|
private readonly AsyncLazy<Storyboard> storyboard;
|
||||||
|
|
||||||
|
private Storyboard populateStoryboard() => GetStoryboard();
|
||||||
|
|
||||||
public void TransferTo(WorkingBeatmap other)
|
public void TransferTo(WorkingBeatmap other)
|
||||||
{
|
{
|
||||||
if (track.IsValueCreated && Track != null && BeatmapInfo.AudioEquals(other.BeatmapInfo))
|
if (track.IsValueCreated && Track != null && BeatmapInfo.AudioEquals(other.BeatmapInfo))
|
||||||
@ -99,6 +107,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
if (BackgroundLoaded) Background?.Dispose();
|
if (BackgroundLoaded) Background?.Dispose();
|
||||||
if (WaveformLoaded) Waveform?.Dispose();
|
if (WaveformLoaded) Waveform?.Dispose();
|
||||||
|
if (StoryboardLoaded) Storyboard?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisposeTrack()
|
public void DisposeTrack()
|
||||||
|
@ -5,10 +5,11 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Storyboards.Drawables;
|
using osu.Game.Storyboards.Drawables;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace osu.Game.Storyboards
|
namespace osu.Game.Storyboards
|
||||||
{
|
{
|
||||||
public class Storyboard
|
public class Storyboard : IDisposable
|
||||||
{
|
{
|
||||||
private readonly Dictionary<string, StoryboardLayer> layers = new Dictionary<string, StoryboardLayer>();
|
private readonly Dictionary<string, StoryboardLayer> layers = new Dictionary<string, StoryboardLayer>();
|
||||||
public IEnumerable<StoryboardLayer> Layers => layers.Values;
|
public IEnumerable<StoryboardLayer> Layers => layers.Values;
|
||||||
@ -59,5 +60,29 @@ namespace osu.Game.Storyboards
|
|||||||
}
|
}
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Disposal
|
||||||
|
|
||||||
|
~Storyboard()
|
||||||
|
{
|
||||||
|
Dispose(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isDisposed;
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
if (isDisposed)
|
||||||
|
return;
|
||||||
|
isDisposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user