mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Use index and range expressions
This commit is contained in:
@ -184,7 +184,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
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[nodeSamples.Count - 1];
|
||||
result.Samples = nodeSamples[^1];
|
||||
}
|
||||
else if (type.HasFlag(ConvertHitObjectType.Spinner))
|
||||
{
|
||||
@ -279,7 +279,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
{
|
||||
if (vertices[i] == vertices[i - 1])
|
||||
{
|
||||
points[points.Count - 1].Type.Value = type;
|
||||
points[^1].Type.Value = type;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
get
|
||||
{
|
||||
ensureValid();
|
||||
return cumulativeLength.Count == 0 ? 0 : cumulativeLength[cumulativeLength.Count - 1];
|
||||
return cumulativeLength.Count == 0 ? 0 : cumulativeLength[^1];
|
||||
}
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
if (calculatedLength > expectedDistance)
|
||||
{
|
||||
// The path will be shortened further, in which case we should trim any more unnecessary lengths and their associated path segments
|
||||
while (cumulativeLength.Count > 0 && cumulativeLength[cumulativeLength.Count - 1] >= expectedDistance)
|
||||
while (cumulativeLength.Count > 0 && cumulativeLength[^1] >= expectedDistance)
|
||||
{
|
||||
cumulativeLength.RemoveAt(cumulativeLength.Count - 1);
|
||||
calculatedPath.RemoveAt(pathEndIndex--);
|
||||
@ -269,7 +269,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
// The direction of the segment to shorten or lengthen
|
||||
Vector2 dir = (calculatedPath[pathEndIndex] - calculatedPath[pathEndIndex - 1]).Normalized();
|
||||
|
||||
calculatedPath[pathEndIndex] = calculatedPath[pathEndIndex - 1] + dir * (float)(expectedDistance - cumulativeLength[cumulativeLength.Count - 1]);
|
||||
calculatedPath[pathEndIndex] = calculatedPath[pathEndIndex - 1] + dir * (float)(expectedDistance - cumulativeLength[^1]);
|
||||
cumulativeLength.Add(expectedDistance);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user