mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 15:02:54 +08:00
Remove list allocations in UpdateNestedSamples
This commit is contained in:
parent
0714a4fc1e
commit
0df6e8f595
@ -252,20 +252,16 @@ namespace osu.Game.Rulesets.Osu.Objects
|
|||||||
|
|
||||||
protected void UpdateNestedSamples()
|
protected void UpdateNestedSamples()
|
||||||
{
|
{
|
||||||
var firstSample = Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)
|
// TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933)
|
||||||
?? Samples.FirstOrDefault(); // TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933)
|
HitSampleInfo tickSample = (Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL) ?? Samples.First()).With("slidertick");
|
||||||
|
|
||||||
var sampleList = new List<HitSampleInfo>();
|
|
||||||
|
|
||||||
if (firstSample != null)
|
|
||||||
sampleList.Add(firstSample.With("slidertick"));
|
|
||||||
|
|
||||||
foreach (var nested in NestedHitObjects)
|
foreach (var nested in NestedHitObjects)
|
||||||
{
|
{
|
||||||
switch (nested)
|
switch (nested)
|
||||||
{
|
{
|
||||||
case SliderTick tick:
|
case SliderTick tick:
|
||||||
tick.Samples = sampleList;
|
tick.SamplesBindable.Clear();
|
||||||
|
tick.SamplesBindable.Add(tickSample);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SliderRepeat repeat:
|
case SliderRepeat repeat:
|
||||||
|
Loading…
Reference in New Issue
Block a user