diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 9038e198cb..976e4a2431 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Framework.MathUtils; using osu.Framework.Screens.Testing; using osu.Game.Screens.Play; @@ -34,15 +35,13 @@ namespace osu.Desktop.VisualTests.Tests private void displayNewValues() { - var random = new Random(); - List newValues = new List(); for (int i = 0; i < 1000; i++) { - newValues.Add(random.Next(0, 11)); + newValues.Add(RNG.Next(0, 11)); } - progress.DisplayValues(newValues); + progress.DisplayValues(newValues.ToArray()); } } } diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index 4b454797ce..30e6c6e737 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -19,6 +19,7 @@ namespace osu.Game.Modes.UI public readonly ScoreCounter ScoreCounter; public readonly PercentageCounter AccuracyCounter; public readonly HealthDisplay HealthDisplay; + public readonly SongProgress Progress; private Bindable showKeyCounter; @@ -27,6 +28,7 @@ namespace osu.Game.Modes.UI protected abstract PercentageCounter CreateAccuracyCounter(); protected abstract ScoreCounter CreateScoreCounter(); protected abstract HealthDisplay CreateHealthDisplay(); + protected abstract SongProgress CreateProgress(); protected HudOverlay() { @@ -39,6 +41,7 @@ namespace osu.Game.Modes.UI ScoreCounter = CreateScoreCounter(), AccuracyCounter = CreateAccuracyCounter(), HealthDisplay = CreateHealthDisplay(), + Progress = CreateProgress(), }; } diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index f77191adf7..d86498208a 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -50,5 +50,17 @@ namespace osu.Game.Modes.UI Position = new Vector2(0, 30), Margin = new MarginPadding { Right = 5 }, }; + + protected override SongProgress CreateProgress() + { + var p = new SongProgress() + { + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + RelativeSizeAxes = Axes.X, + }; + + return p; + } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index bd54e6e263..31f7d3c0b7 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -125,6 +125,7 @@ namespace osu.Game.Screens.Play Depth = -1, OnResume = delegate { + hudOverlay.Progress.State = Visibility.Visible; Delay(400); Schedule(Resume); }, @@ -212,6 +213,7 @@ namespace osu.Game.Screens.Play { lastPauseActionTime = Time.Current; hudOverlay.KeyCounter.IsCounting = true; + hudOverlay.Progress.State = Visibility.Hidden; pauseOverlay.Hide(); sourceClock.Start(); IsPaused = false; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 54e3cc5730..52b45a9fc8 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(OsuGameBase osuGame) { - current = osuGame.Beatmap.Value; + current = osuGame.Beatmap.Value; } protected override void Update() @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Play } } - public void DisplayValues(List values) + public void DisplayValues(int[] values) { graph.Values = values; } diff --git a/osu.Game/Screens/Play/SongProgressGraph.cs b/osu.Game/Screens/Play/SongProgressGraph.cs index 20934fab17..d0caa1201f 100644 --- a/osu.Game/Screens/Play/SongProgressGraph.cs +++ b/osu.Game/Screens/Play/SongProgressGraph.cs @@ -32,8 +32,8 @@ namespace osu.Game.Screens.Play } private List calculatedValues = new List(); // values but adjusted to fit the amount of columns - private List values; - public List Values + private int[] values; + public int[] Values { get { @@ -84,8 +84,8 @@ namespace osu.Game.Screens.Play return; } - float step = values.Count / ColumnCount; - for (float i = 0; i < values.Count; i += step) + float step = values.Length / (float)ColumnCount; + for (float i = 0; i < values.Length; i += step) { calculatedValues.Add(values[(int)i]); } diff --git a/osu.Game/Screens/Play/SongProgressGraphColumn.cs b/osu.Game/Screens/Play/SongProgressGraphColumn.cs index 9d7dd3bc34..514fdcf82a 100644 --- a/osu.Game/Screens/Play/SongProgressGraphColumn.cs +++ b/osu.Game/Screens/Play/SongProgressGraphColumn.cs @@ -12,8 +12,8 @@ namespace osu.Game.Screens.Play { public class SongProgressGraphColumn : Container { - private int rows = 11; - private readonly Color4 emptyColour = Color4.White.Opacity(50); + private readonly int rows = 11; + private readonly Color4 emptyColour = Color4.White.Opacity(100); private readonly Color4 litColour = SongProgress.FILL_COLOUR; private readonly Color4 dimmedColour = Color4.White.Opacity(175); @@ -90,6 +90,7 @@ namespace osu.Game.Screens.Play public enum ColumnState { - Lit, Dimmed + Lit, + Dimmed } }