mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 11:42:56 +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()
|
||||
{
|
||||
var firstSample = Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL)
|
||||
?? Samples.FirstOrDefault(); // TODO: remove this when guaranteed sort is present for samples (https://github.com/ppy/osu/issues/1933)
|
||||
|
||||
var sampleList = new List<HitSampleInfo>();
|
||||
|
||||
if (firstSample != null)
|
||||
sampleList.Add(firstSample.With("slidertick"));
|
||||
// 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");
|
||||
|
||||
foreach (var nested in NestedHitObjects)
|
||||
{
|
||||
switch (nested)
|
||||
{
|
||||
case SliderTick tick:
|
||||
tick.Samples = sampleList;
|
||||
tick.SamplesBindable.Clear();
|
||||
tick.SamplesBindable.Add(tickSample);
|
||||
break;
|
||||
|
||||
case SliderRepeat repeat:
|
||||
|
Loading…
Reference in New Issue
Block a user