1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 12:35:34 +08:00

Add support for playing a SkinnableSample without restarting it

This commit is contained in:
Dean Herbert 2021-01-15 17:16:12 +09:00
parent 40f020c683
commit 8a6857f151
2 changed files with 5 additions and 4 deletions

View File

@ -67,7 +67,7 @@ namespace osu.Game.Skinning
}
}
public override void Play()
public override void Play(bool restart = true)
{
cancelPendingStart();
RequestedPlaying = true;
@ -75,7 +75,7 @@ namespace osu.Game.Skinning
if (samplePlaybackDisabled.Value)
return;
base.Play();
base.Play(restart);
}
public override void Stop()

View File

@ -119,12 +119,13 @@ namespace osu.Game.Skinning
/// <summary>
/// Plays the samples.
/// </summary>
public virtual void Play()
/// <param name="restart">Whether to play the sample from the beginning.</param>
public virtual void Play(bool restart = true)
{
samplesContainer.ForEach(c =>
{
if (PlayWhenZeroVolume || c.AggregateVolume.Value > 0)
c.Play();
c.Play(restart);
});
}