1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 08:07:24 +08:00

More cleanup

This commit is contained in:
DrabWeb 2017-03-23 23:38:23 -03:00
parent 0a11d035fe
commit b56fb310bf
3 changed files with 9 additions and 15 deletions

View File

@ -11,7 +11,7 @@ namespace osu.Desktop.VisualTests.Tests
{
internal class TestCaseSongProgress : TestCase
{
public override string Description => @"With (half)real data";
public override string Description => @"With fake data";
private SongProgress progress;

View File

@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play
{
public class SongProgress : OverlayContainer
{
private const int bar_height = 5;
private const int progress_height = 5;
private readonly Vector2 handleSize = new Vector2(14, 25);
private readonly Color4 fillColour = new Color4(221, 255, 255, 255);
private const float transition_duration = 200;
@ -54,7 +54,7 @@ namespace osu.Game.Screens.Play
public SongProgress()
{
RelativeSizeAxes = Axes.X;
Height = bar_height + SongProgressGraph.Column.HEIGHT + handleSize.Y;
Height = progress_height + SongProgressGraph.Column.HEIGHT + handleSize.Y;
Children = new Drawable[]
{
@ -66,10 +66,10 @@ namespace osu.Game.Screens.Play
Height = SongProgressGraph.Column.HEIGHT,
Margin = new MarginPadding
{
Bottom = bar_height,
Bottom = progress_height,
},
},
bar = new SongProgressBar(bar_height, SongProgressGraph.Column.HEIGHT, handleSize, fillColour)
bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handleSize, fillColour)
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Play
{
bar.IsEnabled = false;
bar.FadeOut(transition_duration, EasingTypes.In);
MoveTo(new Vector2(0f, bar_height), transition_duration, EasingTypes.In);
MoveTo(new Vector2(0f, progress_height), transition_duration, EasingTypes.In);
}
}
}

View File

@ -16,7 +16,6 @@ namespace osu.Game.Screens.Play
public class SongProgressGraph : BufferedContainer
{
private Column[] columns = { };
private float lastDrawWidth;
public int ColumnCount => columns.Length;
@ -54,6 +53,7 @@ namespace osu.Game.Screens.Play
PixelSnapping = true;
}
private float lastDrawWidth;
protected override void Update()
{
base.Update();
@ -98,9 +98,7 @@ namespace osu.Game.Screens.Play
if (values == null)
{
for (float i = 0; i < ColumnCount; i++)
{
newValues.Add(0);
}
return;
}
@ -192,10 +190,10 @@ namespace osu.Game.Screens.Play
Size = new Vector2(cube_size),
Position = new Vector2(0, r * WIDTH + padding),
});
Add(drawableRows[drawableRows.Count - 1]);
}
Children = drawableRows;
// Reverse drawableRows so when iterating through them they start at the bottom
drawableRows.Reverse();
}
@ -207,13 +205,9 @@ namespace osu.Game.Screens.Play
for (int i = 0; i < drawableRows.Count; i++)
{
if (Filled == 0) // i <= Filled doesn't work for zero fill
{
drawableRows[i].Colour = emptyColour;
}
else
{
drawableRows[i].Colour = i <= Filled ? colour : emptyColour;
}
}
}
}