mirror of
https://github.com/ppy/osu
synced 2024-12-14 02:46:27 +00:00
Updated DrawableStoryboardSample to use GetBoundCopy()
This commit is contained in:
parent
b220939650
commit
07ec0c0e0b
@ -18,6 +18,10 @@ namespace osu.Game.Skinning
|
||||
|
||||
protected bool RequestedPlaying { get; private set; }
|
||||
|
||||
protected IBindable<bool> SamplePlaybackDisabled => samplePlaybackDisabled;
|
||||
|
||||
private readonly Bindable<bool> samplePlaybackDisabled = new Bindable<bool>();
|
||||
|
||||
public PausableSkinnableSound()
|
||||
{
|
||||
}
|
||||
@ -32,8 +36,6 @@ namespace osu.Game.Skinning
|
||||
{
|
||||
}
|
||||
|
||||
protected readonly IBindable<bool> SamplePlaybackDisabled = new Bindable<bool>();
|
||||
|
||||
private ScheduledDelegate scheduledStart;
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
|
@ -21,11 +21,29 @@ namespace osu.Game.Storyboards.Drawables
|
||||
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
|
||||
private readonly IBindable<bool> samplePlaybackDisabled;
|
||||
|
||||
public DrawableStoryboardSample(StoryboardSampleInfo sampleInfo)
|
||||
: base(sampleInfo)
|
||||
{
|
||||
this.sampleInfo = sampleInfo;
|
||||
LifetimeStart = sampleInfo.StartTime;
|
||||
|
||||
samplePlaybackDisabled = SamplePlaybackDisabled.GetBoundCopy();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load()
|
||||
{
|
||||
samplePlaybackDisabled.BindValueChanged(disabled =>
|
||||
{
|
||||
if (!RequestedPlaying) return;
|
||||
|
||||
// Since storyboard samples can be very long we want to stop the playback regardless of
|
||||
// whether or not the sample is looping or not
|
||||
if (disabled.NewValue)
|
||||
Stop();
|
||||
});
|
||||
}
|
||||
|
||||
[Resolved]
|
||||
@ -40,16 +58,6 @@ namespace osu.Game.Storyboards.Drawables
|
||||
foreach (var sample in DrawableSamples)
|
||||
mod.ApplyToSample(sample);
|
||||
}
|
||||
|
||||
SamplePlaybackDisabled.BindValueChanged(disabled =>
|
||||
{
|
||||
if (!RequestedPlaying) return;
|
||||
|
||||
// Since storyboard samples can be very long we want to stop the playback regardless of
|
||||
// whether or not the sample is looping or not
|
||||
if (disabled.NewValue)
|
||||
Stop();
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
|
Loading…
Reference in New Issue
Block a user