From 0edee042008c8de0a48b681317eb72bdacd5086f Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Fri, 24 Mar 2017 00:41:14 -0300 Subject: [PATCH] Use OsuColour instead of static colours --- osu.Game/Screens/Play/SongProgress.cs | 20 ++++++++++++-------- osu.Game/Screens/Play/SongProgressBar.cs | 9 +++++++-- osu.Game/Screens/Play/SongProgressGraph.cs | 20 +++++++++++++++++--- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 09e0c7cfba..5f1fd974ed 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -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 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, diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index f720e2bf96..f8ee030d21 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -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; diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index f6dfbc2715..9bac81a721 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -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 { 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++) {