1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 22:22:55 +08:00

Remove previous samples on change

This commit is contained in:
smoogipoo 2019-11-08 16:19:55 +09:00
parent a9b4106075
commit b4cb4c1243

View File

@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
// Todo: Rulesets should be overriding the resources instead, but we need to figure out where/when to apply overrides first // Todo: Rulesets should be overriding the resources instead, but we need to figure out where/when to apply overrides first
protected virtual string SampleNamespace => null; protected virtual string SampleNamespace => null;
protected SkinnableSound Samples; protected SkinnableSound Samples { get; private set; }
protected virtual IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples; protected virtual IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples;
@ -137,6 +137,12 @@ namespace osu.Game.Rulesets.Objects.Drawables
private void loadSamples() private void loadSamples()
{ {
if (Samples != null)
{
RemoveInternal(Samples);
Samples = null;
}
var samples = GetSamples().ToArray(); var samples = GetSamples().ToArray();
if (samples.Length <= 0) if (samples.Length <= 0)