Rename grid creation method + parameter

This commit is contained in:
smoogipoo 2019-10-11 15:41:40 +09:00
parent 5f0cd356d7
commit 9ecec806c2
2 changed files with 12 additions and 12 deletions

View File

@ -138,63 +138,63 @@ namespace osu.Game.Tests.Visual.Editor
{ {
} }
protected override void CreateGrid(Vector2 startPosition) protected override void CreateContent(Vector2 centrePosition)
{ {
AddInternal(new Circle AddInternal(new Circle
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(5), Size = new Vector2(5),
Position = startPosition Position = centrePosition
}); });
int beatIndex = 0; int beatIndex = 0;
for (float s = startPosition.X + DistanceSpacing; s <= DrawWidth; s += DistanceSpacing, beatIndex++) for (float s = centrePosition.X + DistanceSpacing; s <= DrawWidth; s += DistanceSpacing, beatIndex++)
{ {
AddInternal(new Circle AddInternal(new Circle
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(5, 10), Size = new Vector2(5, 10),
Position = new Vector2(s, startPosition.Y), Position = new Vector2(s, centrePosition.Y),
Colour = GetColourForBeatIndex(beatIndex) Colour = GetColourForBeatIndex(beatIndex)
}); });
} }
beatIndex = 0; beatIndex = 0;
for (float s = startPosition.X - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++) for (float s = centrePosition.X - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++)
{ {
AddInternal(new Circle AddInternal(new Circle
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(5, 10), Size = new Vector2(5, 10),
Position = new Vector2(s, startPosition.Y), Position = new Vector2(s, centrePosition.Y),
Colour = GetColourForBeatIndex(beatIndex) Colour = GetColourForBeatIndex(beatIndex)
}); });
} }
beatIndex = 0; beatIndex = 0;
for (float s = startPosition.Y + DistanceSpacing; s <= DrawHeight; s += DistanceSpacing, beatIndex++) for (float s = centrePosition.Y + DistanceSpacing; s <= DrawHeight; s += DistanceSpacing, beatIndex++)
{ {
AddInternal(new Circle AddInternal(new Circle
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(10, 5), Size = new Vector2(10, 5),
Position = new Vector2(startPosition.X, s), Position = new Vector2(centrePosition.X, s),
Colour = GetColourForBeatIndex(beatIndex) Colour = GetColourForBeatIndex(beatIndex)
}); });
} }
beatIndex = 0; beatIndex = 0;
for (float s = startPosition.Y - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++) for (float s = centrePosition.Y - DistanceSpacing; s >= 0; s -= DistanceSpacing, beatIndex++)
{ {
AddInternal(new Circle AddInternal(new Circle
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(10, 5), Size = new Vector2(10, 5),
Position = new Vector2(startPosition.X, s), Position = new Vector2(centrePosition.X, s),
Colour = GetColourForBeatIndex(beatIndex) Colour = GetColourForBeatIndex(beatIndex)
}); });
} }

View File

@ -92,7 +92,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (!gridCache.IsValid) if (!gridCache.IsValid)
{ {
ClearInternal(); ClearInternal();
CreateGrid(StartPosition); CreateContent(CentrePosition);
gridCache.Validate(); gridCache.Validate();
} }
} }
@ -100,7 +100,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <summary> /// <summary>
/// Creates the content which visualises the grid ticks. /// Creates the content which visualises the grid ticks.
/// </summary> /// </summary>
protected abstract void CreateGrid(Vector2 startPosition); protected abstract void CreateContent(Vector2 centrePosition);
/// <summary> /// <summary>
/// Retrieves the velocity of gameplay at a point in time in pixels per millisecond. /// Retrieves the velocity of gameplay at a point in time in pixels per millisecond.