1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-18 06:27:18 +08:00

Add vertical grid lines

This commit is contained in:
Dean Herbert 2022-10-17 23:49:15 +09:00
parent 1ea2a1ff04
commit 19b4d2d25e

View File

@ -180,6 +180,7 @@ namespace osu.Game.Tests.Gameplay
private readonly Box hoverLine;
private readonly Container missLines;
private readonly Container verticalGridLines;
public GraphContainer()
{
@ -193,6 +194,10 @@ namespace osu.Game.Tests.Gameplay
Colour = OsuColour.Gray(0.1f),
RelativeSizeAxes = Axes.Both,
},
verticalGridLines = new Container
{
RelativeSizeAxes = Axes.Both,
},
Content,
hoverLine = new Box
{
@ -208,9 +213,33 @@ namespace osu.Game.Tests.Gameplay
}
};
MissLocations.BindCollectionChanged((_, _) => updateMissLocations(), true);
MissLocations.BindCollectionChanged((_, _) => updateMissLocations());
MaxCombo.BindValueChanged(_ => updateMissLocations());
MaxCombo.BindValueChanged(_ =>
{
updateMissLocations();
updateVerticalGridLines();
}, true);
}
private void updateVerticalGridLines()
{
verticalGridLines.Clear();
for (int i = 0; i < MaxCombo.Value; i++)
{
if (i % 100 == 0)
{
verticalGridLines.Add(new Box
{
Colour = OsuColour.Gray(0.2f),
Width = 1,
RelativeSizeAxes = Axes.Y,
RelativePositionAxes = Axes.X,
X = (float)i / MaxCombo.Value,
});
}
}
}
private void updateMissLocations()