mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 01:23:44 +08:00
Adjust logic to avoid creating List<>
each playback
This commit is contained in:
parent
32c0f13f79
commit
571dbf5ab8
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -23,18 +22,20 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
if (hitObject == null)
|
if (hitObject == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<ISampleInfo> samplesToPlay = new List<ISampleInfo>
|
var baseSample = hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_CLAP : HitSampleInfo.HIT_NORMAL);
|
||||||
{
|
|
||||||
hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_CLAP : HitSampleInfo.HIT_NORMAL)
|
|
||||||
};
|
|
||||||
|
|
||||||
// strong + rim always maps to whistle.
|
|
||||||
if ((hitObject as TaikoStrongableHitObject)?.IsStrong == true || hitObject is StrongNestedHitObject)
|
if ((hitObject as TaikoStrongableHitObject)?.IsStrong == true || hitObject is StrongNestedHitObject)
|
||||||
{
|
{
|
||||||
samplesToPlay.Add(hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_WHISTLE : HitSampleInfo.HIT_FINISH));
|
PlaySamples(new ISampleInfo[]
|
||||||
|
{
|
||||||
|
hitObject.CreateHitSampleInfo(hitType == HitType.Rim ? HitSampleInfo.HIT_WHISTLE : HitSampleInfo.HIT_FINISH),
|
||||||
|
baseSample
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
PlaySamples(new ISampleInfo[] { baseSample });
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaySamples(samplesToPlay.ToArray());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Play() => throw new InvalidOperationException(@"Use override with HitType parameter instead");
|
public override void Play() => throw new InvalidOperationException(@"Use override with HitType parameter instead");
|
||||||
|
Loading…
Reference in New Issue
Block a user