mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
some fixing and restyling.
This commit is contained in:
parent
4d61424abd
commit
b5d661b53a
@ -21,8 +21,8 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
Add(progress = new SongProgress
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X
|
||||
});
|
||||
|
||||
|
@ -15,7 +15,6 @@ namespace osu.Game.Screens.Play
|
||||
public class SongProgress : OverlayContainer
|
||||
{
|
||||
public static readonly int BAR_HEIGHT = 5;
|
||||
public static readonly int GRAPH_HEIGHT = 34;
|
||||
public static readonly Color4 FILL_COLOUR = new Color4(221, 255, 255, 255);
|
||||
public static readonly Color4 GLOW_COLOUR = new Color4(221, 255, 255, 150);
|
||||
private const float progress_transition_duration = 100;
|
||||
@ -68,7 +67,7 @@ namespace osu.Game.Screens.Play
|
||||
public SongProgress()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = BAR_HEIGHT + GRAPH_HEIGHT + SongProgressBar.HANDLE_SIZE.Y;
|
||||
Height = BAR_HEIGHT + SongProgressGraphColumn.HEIGHT + SongProgressBar.HANDLE_SIZE.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -77,7 +76,7 @@ namespace osu.Game.Screens.Play
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Height = GRAPH_HEIGHT,
|
||||
Height = SongProgressGraphColumn.HEIGHT,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = BAR_HEIGHT
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.BottomRight,
|
||||
Anchor = Anchor.BottomRight,
|
||||
Width = 2,
|
||||
Height = SongProgress.BAR_HEIGHT + SongProgress.GRAPH_HEIGHT,
|
||||
Height = SongProgress.BAR_HEIGHT + SongProgressGraphColumn.HEIGHT,
|
||||
Colour = Color4.White,
|
||||
Position = new Vector2(2, 0),
|
||||
Children = new Drawable[]
|
||||
|
@ -93,14 +93,14 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private void recreateGraph()
|
||||
{
|
||||
RemoveAll(delegate { return true; });
|
||||
columns.RemoveAll(delegate { return true; });
|
||||
Clear();
|
||||
columns.Clear();
|
||||
|
||||
for (int x = 0; x < DrawWidth; x += 3)
|
||||
for (float x = 0; x < DrawWidth; x += SongProgressGraphColumn.WIDTH)
|
||||
{
|
||||
columns.Add(new SongProgressGraphColumn
|
||||
{
|
||||
Position = new Vector2(x + 1, 0),
|
||||
Position = new Vector2(x, 0),
|
||||
State = ColumnState.Dimmed,
|
||||
});
|
||||
|
||||
|
@ -12,12 +12,19 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class SongProgressGraphColumn : Container
|
||||
{
|
||||
private readonly int rows = 11;
|
||||
private const float cube_count = 6;
|
||||
private const float cube_size = 4;
|
||||
private const float padding = 2;
|
||||
|
||||
public const float WIDTH = cube_size + padding;
|
||||
|
||||
public const float HEIGHT = cube_count * WIDTH;
|
||||
|
||||
private readonly Color4 emptyColour = Color4.White.Opacity(100);
|
||||
private readonly Color4 litColour = SongProgress.FILL_COLOUR;
|
||||
private readonly Color4 dimmedColour = Color4.White.Opacity(175);
|
||||
|
||||
private List<Box> drawableRows = new List<Box>();
|
||||
private readonly List<Box> drawableRows = new List<Box>();
|
||||
|
||||
private int filled;
|
||||
public int Filled
|
||||
@ -51,6 +58,26 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
public SongProgressGraphColumn()
|
||||
{
|
||||
Size = new Vector2(WIDTH, HEIGHT);
|
||||
|
||||
for (int r = 0; r < cube_count; r++)
|
||||
{
|
||||
drawableRows.Add(new Box
|
||||
{
|
||||
EdgeSmoothness = new Vector2(padding / 4),
|
||||
Size = new Vector2(cube_size),
|
||||
Position = new Vector2(0, r * WIDTH + padding)
|
||||
});
|
||||
|
||||
Add(drawableRows[drawableRows.Count - 1]);
|
||||
}
|
||||
|
||||
// Reverse drawableRows so when iterating through them they start at the bottom
|
||||
drawableRows.Reverse();
|
||||
}
|
||||
|
||||
private void fillActive()
|
||||
{
|
||||
Color4 colour = State == ColumnState.Lit ? litColour : dimmedColour;
|
||||
@ -67,25 +94,6 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SongProgressGraphColumn()
|
||||
{
|
||||
Size = new Vector2(4, rows * 3);
|
||||
|
||||
for (int row = 0; row < rows * 3; row += 3)
|
||||
{
|
||||
drawableRows.Add(new Box
|
||||
{
|
||||
Size = new Vector2(2),
|
||||
Position = new Vector2(0, row + 1)
|
||||
});
|
||||
|
||||
Add(drawableRows[drawableRows.Count - 1]);
|
||||
}
|
||||
|
||||
// Reverse drawableRows so when iterating through them they start at the bottom
|
||||
drawableRows.Reverse();
|
||||
}
|
||||
}
|
||||
|
||||
public enum ColumnState
|
||||
|
Loading…
Reference in New Issue
Block a user