From c61052d62e1215b79ed67ba98ee3ca2ed9f28b56 Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Thu, 9 Feb 2017 20:12:15 -0400 Subject: [PATCH] Added toggling the progress bar, added buttons to the visual test --- .../Tests/TestCaseSongProgress.cs | 13 ++++++++----- osu.Game/Screens/Play/SongProgress.cs | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs index 1f0b993fee..9706348494 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseSongProgress.cs @@ -24,11 +24,6 @@ namespace osu.Desktop.VisualTests { base.Reset(); - Add(new Box - { - Colour = Color4.Gray, - RelativeSizeAxes = Axes.Both - }); Add(progress = new SongProgress { Anchor = Anchor.BottomCentre, @@ -36,6 +31,14 @@ namespace osu.Desktop.VisualTests RelativeSizeAxes = Axes.X }); + AddButton("Toggle Bar", progress.ToggleVisibility); + AddButton("New Values", displayNewValues); + + displayNewValues(); + } + + private void displayNewValues() + { var random = new Random(); List newValues = new List(); diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 8568d30d38..55888d72f3 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -13,15 +13,17 @@ using osu.Framework.Graphics.Primitives; using osu.Game.Overlays; using System.Collections.Generic; using System; +using osu.Framework.Graphics.Transformations; namespace osu.Game.Screens.Play { - public class SongProgress : Container + 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 float progress_transition_duration = 100; private SongProgressBar progress; private SongProgressGraph graph; @@ -56,6 +58,18 @@ namespace osu.Game.Screens.Play graph.Values = values; } + protected override void PopIn() + { + progress.FadeTo(1f, progress_transition_duration, EasingTypes.In); + MoveTo(Vector2.Zero, progress_transition_duration, EasingTypes.In); + } + + protected override void PopOut() + { + progress.FadeTo(0f, progress_transition_duration, EasingTypes.In); + MoveTo(new Vector2(0f, BAR_HEIGHT), progress_transition_duration, EasingTypes.In); + } + public SongProgress() { RelativeSizeAxes = Axes.X;