mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:52:55 +08:00
Use OsuColour instead of static colours
This commit is contained in:
parent
f1f6f2041f
commit
0edee04200
@ -8,6 +8,8 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using System;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
@ -15,11 +17,10 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
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;
|
||||
|
||||
private readonly SongProgressBar bar;
|
||||
private readonly SongProgressGraph graph;
|
||||
private SongProgressBar bar;
|
||||
private SongProgressGraph graph;
|
||||
|
||||
public Action<double> OnSeek;
|
||||
|
||||
@ -51,6 +52,12 @@ namespace osu.Game.Screens.Play
|
||||
set { graph.Values = value; }
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
graph.FillColour = bar.FillColour = colours.BlueLighter;
|
||||
}
|
||||
|
||||
public SongProgress()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -64,12 +71,9 @@ namespace osu.Game.Screens.Play
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Height = SongProgressGraph.Column.HEIGHT,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = progress_height,
|
||||
},
|
||||
Margin = new MarginPadding { Bottom = progress_height },
|
||||
},
|
||||
bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handleSize, fillColour)
|
||||
bar = new SongProgressBar(progress_height, SongProgressGraph.Column.HEIGHT, handleSize)
|
||||
{
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
|
@ -12,9 +12,14 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class SongProgressBar : DragBar
|
||||
{
|
||||
public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize, Color4 fillColour)
|
||||
public Color4 FillColour
|
||||
{
|
||||
get { return Fill.Colour; }
|
||||
set { Fill.Colour = value; }
|
||||
}
|
||||
|
||||
public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize)
|
||||
{
|
||||
Fill.Colour = fillColour;
|
||||
Height = barHeight + handleBarHeight + handleSize.Y;
|
||||
FillContainer.RelativeSizeAxes = Axes.X;
|
||||
FillContainer.Height = barHeight;
|
||||
|
@ -47,6 +47,19 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 fillColour;
|
||||
public Color4 FillColour
|
||||
{
|
||||
get { return fillColour; }
|
||||
set
|
||||
{
|
||||
if (value == fillColour) return;
|
||||
fillColour = value;
|
||||
|
||||
redrawFilled();
|
||||
}
|
||||
}
|
||||
|
||||
public SongProgressGraph()
|
||||
{
|
||||
CacheDrawnFrameBuffer = true;
|
||||
@ -121,7 +134,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
for (float x = 0; x < DrawWidth; x += Column.WIDTH)
|
||||
{
|
||||
newColumns.Add(new Column
|
||||
newColumns.Add(new Column(fillColour)
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
@ -141,7 +154,7 @@ namespace osu.Game.Screens.Play
|
||||
public class Column : Container, IStateful<ColumnState>
|
||||
{
|
||||
private readonly Color4 emptyColour = Color4.White.Opacity(100);
|
||||
private readonly Color4 litColour = new Color4(221, 255, 255, 255);
|
||||
private readonly Color4 litColour;
|
||||
private readonly Color4 dimmedColour = Color4.White.Opacity(175);
|
||||
|
||||
private const float cube_count = 6;
|
||||
@ -178,9 +191,10 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
public Column()
|
||||
public Column(Color4 litColour)
|
||||
{
|
||||
Size = new Vector2(WIDTH, HEIGHT);
|
||||
this.litColour = litColour;
|
||||
|
||||
for (int r = 0; r < cube_count; r++)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user