mirror of
https://github.com/ppy/osu
synced 2025-02-27 16:11:43 +00:00
Bring back and make use of clearPreviousSamples()
This commit is contained in:
parent
1478a26cc0
commit
e6f1ec57a9
@ -4,6 +4,7 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
@ -74,14 +75,29 @@ namespace osu.Game.Skinning
|
|||||||
updateSample();
|
updateSample();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateSample()
|
/// <summary>
|
||||||
{
|
/// Whether this sample was playing before a skin source change.
|
||||||
if (sampleInfo == null)
|
/// </summary>
|
||||||
return;
|
private bool wasPlaying;
|
||||||
|
|
||||||
bool wasPlaying = Playing;
|
private void clearPreviousSamples()
|
||||||
|
{
|
||||||
|
// only run if the samples aren't already cleared.
|
||||||
|
// this ensures the "wasPlaying" state is stored correctly even if multiple clear calls are executed.
|
||||||
|
if (!sampleContainer.Any()) return;
|
||||||
|
|
||||||
|
wasPlaying = Playing;
|
||||||
|
|
||||||
sampleContainer.Clear();
|
sampleContainer.Clear();
|
||||||
|
Sample = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateSample()
|
||||||
|
{
|
||||||
|
clearPreviousSamples();
|
||||||
|
|
||||||
|
if (sampleInfo == null)
|
||||||
|
return;
|
||||||
|
|
||||||
var sample = CurrentSkin.GetSample(sampleInfo);
|
var sample = CurrentSkin.GetSample(sampleInfo);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user