1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 12:43:16 +08:00

Reduce duplication in new logic

This commit is contained in:
Bartłomiej Dach 2024-07-04 14:40:40 +02:00
parent ea4e6cf1d7
commit 72492a79cd
No known key found for this signature in database

View File

@ -156,24 +156,20 @@ namespace osu.Game.Rulesets.Edit
comboInformation.UpdateComboInformation(getPreviousHitObject() as IHasComboInformation);
}
if (AutomaticBankAssignment)
{
// Take the hitnormal sample of the last hit object
var lastHitNormal = getPreviousHitObject()?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
if (lastHitNormal != null)
HitObject.Samples[0] = lastHitNormal;
}
else
{
// Only inherit the volume from the previous hit object
var lastHitNormal = getPreviousHitObject()?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
var lastHitNormal = getPreviousHitObject()?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
if (lastHitNormal != null)
if (lastHitNormal != null)
{
if (AutomaticBankAssignment)
{
// Take the hitnormal sample of the last hit object
HitObject.Samples[0] = lastHitNormal;
}
else
{
// Only inherit the volume from the previous hit object
for (int i = 0; i < HitObject.Samples.Count; i++)
{
HitObject.Samples[i] = HitObject.Samples[i].With(newVolume: lastHitNormal.Volume);
}
}
}
}