mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:52:57 +08:00
Fix slider/spinner samples not being disposed
This commit is contained in:
parent
0abda7b557
commit
3f0a127196
@ -40,6 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
private Container<DrawableSliderTail> tailContainer;
|
||||
private Container<DrawableSliderTick> tickContainer;
|
||||
private Container<DrawableSliderRepeat> repeatContainer;
|
||||
private Container<PausableSkinnableSound> samplesContainer;
|
||||
|
||||
public DrawableSlider()
|
||||
: this(null)
|
||||
@ -68,6 +69,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
Alpha = 0
|
||||
},
|
||||
headContainer = new Container<DrawableSliderHead> { RelativeSizeAxes = Axes.Both },
|
||||
samplesContainer = new Container<PausableSkinnableSound> { RelativeSizeAxes = Axes.Both }
|
||||
};
|
||||
|
||||
PositionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition);
|
||||
@ -105,7 +107,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
base.LoadSamples();
|
||||
|
||||
slidingSample?.Expire();
|
||||
samplesContainer.Clear();
|
||||
slidingSample = null;
|
||||
|
||||
var firstSample = HitObject.Samples.FirstOrDefault();
|
||||
@ -115,7 +117,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
var clone = HitObject.SampleControlPoint.ApplyTo(firstSample);
|
||||
clone.Name = "sliderslide";
|
||||
|
||||
AddInternal(slidingSample = new PausableSkinnableSound(clone)
|
||||
samplesContainer.Add(slidingSample = new PausableSkinnableSound(clone)
|
||||
{
|
||||
Looping = true
|
||||
});
|
||||
|
@ -29,6 +29,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
private Container<DrawableSpinnerTick> ticks;
|
||||
private SpinnerBonusDisplay bonusDisplay;
|
||||
private Container<PausableSkinnableSound> samplesContainer;
|
||||
|
||||
private Bindable<bool> isSpinning;
|
||||
private bool spinnerFrequencyModulate;
|
||||
@ -75,7 +76,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Y = -120,
|
||||
}
|
||||
},
|
||||
samplesContainer = new Container<PausableSkinnableSound> { RelativeSizeAxes = Axes.Both }
|
||||
};
|
||||
|
||||
PositionBindable.BindValueChanged(pos => Position = pos.NewValue);
|
||||
@ -97,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
base.LoadSamples();
|
||||
|
||||
spinningSample?.Expire();
|
||||
samplesContainer.Clear();
|
||||
spinningSample = null;
|
||||
|
||||
var firstSample = HitObject.Samples.FirstOrDefault();
|
||||
@ -107,7 +109,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
var clone = HitObject.SampleControlPoint.ApplyTo(firstSample);
|
||||
clone.Name = "spinnerspin";
|
||||
|
||||
AddInternal(spinningSample = new PausableSkinnableSound(clone)
|
||||
samplesContainer.Add(spinningSample = new PausableSkinnableSound(clone)
|
||||
{
|
||||
Volume = { Value = 0 },
|
||||
Looping = true,
|
||||
|
Loading…
Reference in New Issue
Block a user