mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Fix slider samples being overwritten by the last node
This commit is contained in:
@ -184,9 +184,6 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
|
||||
|
||||
result = CreateSlider(pos, combo, comboOffset, convertControlPoints(points, pathType), length, repeatCount, nodeSamples);
|
||||
|
||||
// The samples are played when the slider ends, which is the last node
|
||||
result.Samples = nodeSamples[^1];
|
||||
}
|
||||
else if (type.HasFlag(LegacyHitObjectType.Spinner))
|
||||
{
|
||||
|
@ -35,5 +35,15 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// </summary>
|
||||
/// <param name="obj">The object that has repeats.</param>
|
||||
public static int SpanCount(this IHasRepeats obj) => obj.RepeatCount + 1;
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the samples at a particular node in a <see cref="IHasRepeats"/> object.
|
||||
/// </summary>
|
||||
/// <param name="obj">The <see cref="HitObject"/>.</param>
|
||||
/// <param name="nodeIndex">The node to attempt to retrieve the samples at.</param>
|
||||
/// <returns>The samples at the given node index, or <paramref name="obj"/>'s default samples if the given node doesn't exist.</returns>
|
||||
public static IList<HitSampleInfo> GetNodeSamples<T>(this T obj, int nodeIndex)
|
||||
where T : HitObject, IHasRepeats
|
||||
=> nodeIndex < obj.NodeSamples.Count ? obj.NodeSamples[nodeIndex] : obj.Samples;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user