1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 20:53:00 +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,27 +156,23 @@ namespace osu.Game.Rulesets.Edit
comboInformation.UpdateComboInformation(getPreviousHitObject() as IHasComboInformation); comboInformation.UpdateComboInformation(getPreviousHitObject() as IHasComboInformation);
} }
var lastHitNormal = getPreviousHitObject()?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
if (lastHitNormal != null)
{
if (AutomaticBankAssignment) if (AutomaticBankAssignment)
{ {
// Take the hitnormal sample of the last hit object // 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; HitObject.Samples[0] = lastHitNormal;
} }
else else
{ {
// Only inherit the volume from the previous hit object // Only inherit the volume from the previous hit object
var lastHitNormal = getPreviousHitObject()?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
if (lastHitNormal != null)
{
for (int i = 0; i < HitObject.Samples.Count; i++) for (int i = 0; i < HitObject.Samples.Count; i++)
{
HitObject.Samples[i] = HitObject.Samples[i].With(newVolume: lastHitNormal.Volume); HitObject.Samples[i] = HitObject.Samples[i].With(newVolume: lastHitNormal.Volume);
} }
} }
} }
}
/// <summary> /// <summary>
/// Invokes <see cref="Objects.HitObject.ApplyDefaults(ControlPointInfo,IBeatmapDifficultyInfo,CancellationToken)"/>, /// Invokes <see cref="Objects.HitObject.ApplyDefaults(ControlPointInfo,IBeatmapDifficultyInfo,CancellationToken)"/>,