1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 11:22:57 +08:00

Use array for fixed-size list

This commit is contained in:
ekrctb 2021-10-26 10:41:17 +09:00
parent 6d1cd0a3a1
commit 2c92f1a0b7

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Catch.Edit
private readonly List<Path> verticalPaths = new List<Path>(); private readonly List<Path> verticalPaths = new List<Path>();
private readonly List<List<Vector2>> verticalLineVertices = new List<List<Vector2>>(); private readonly List<Vector2[]> verticalLineVertices = new List<Vector2[]>();
[Resolved] [Resolved]
private Playfield playfield { get; set; } private Playfield playfield { get; set; }
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Catch.Edit
Alpha = 0.5f, Alpha = 0.5f,
}); });
verticalLineVertices.Add(new List<Vector2> { Vector2.Zero, Vector2.Zero }); verticalLineVertices.Add(new[] { Vector2.Zero, Vector2.Zero });
} }
AddRangeInternal(verticalPaths); AddRangeInternal(verticalPaths);
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Catch.Edit
float x = (float)((endTime - StartTime) * velocity); float x = (float)((endTime - StartTime) * velocity);
float y = hitObjectContainer.PositionAtTime(endTime, StartTime); float y = hitObjectContainer.PositionAtTime(endTime, StartTime);
List<Vector2> lineVertices = verticalLineVertices[i]; Vector2[] lineVertices = verticalLineVertices[i];
lineVertices[0] = new Vector2(StartX, startY); lineVertices[0] = new Vector2(StartX, startY);
lineVertices[1] = lineVertices[0] + new Vector2(x, y); lineVertices[1] = lineVertices[0] + new Vector2(x, y);