1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 00:02:56 +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(); cancelPendingStart();
RequestedPlaying = true; RequestedPlaying = true;
@ -75,7 +75,7 @@ namespace osu.Game.Skinning
if (samplePlaybackDisabled.Value) if (samplePlaybackDisabled.Value)
return; return;
base.Play(); base.Play(restart);
} }
public override void Stop() public override void Stop()

View File

@ -119,12 +119,13 @@ namespace osu.Game.Skinning
/// <summary> /// <summary>
/// Plays the samples. /// Plays the samples.
/// </summary> /// </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 => samplesContainer.ForEach(c =>
{ {
if (PlayWhenZeroVolume || c.AggregateVolume.Value > 0) if (PlayWhenZeroVolume || c.AggregateVolume.Value > 0)
c.Play(); c.Play(restart);
}); });
} }