From bc4e0bfa8b2ceebeec41675692a18b861f4aeec1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Apr 2017 09:57:34 +0900 Subject: [PATCH 01/45] Make DragBar animate seeks. --- osu.Game/Overlays/DragBar.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index a9cf735171..dc79b1f094 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Transforms; using osu.Framework.Input; namespace osu.Game.Overlays @@ -48,7 +49,7 @@ namespace osu.Game.Overlays { if (isDragging || !IsEnabled) return; - fill.Width = position; + updatePosition(position); } private void seek(InputState state) @@ -56,7 +57,12 @@ namespace osu.Game.Overlays if (!IsEnabled) return; float seekLocation = state.Mouse.Position.X / DrawWidth; SeekRequested?.Invoke(seekLocation); - fill.Width = seekLocation; + updatePosition(seekLocation); + } + + private void updatePosition(float position) + { + fill.TransformTo(fill.Width, position, 100, EasingTypes.OutQuint, new TransformWidth()); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -78,5 +84,14 @@ namespace osu.Game.Overlays isDragging = false; return true; } + + private class TransformWidth : TransformFloat + { + public override void Apply(Drawable d) + { + base.Apply(d); + d.Width = CurrentValue; + } + } } } From 7c9f30c2885df26f7c9fdec4cef7e546da43af84 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Apr 2017 11:02:37 +0900 Subject: [PATCH 02/45] MusicController regression fixes. --- osu.Game/Overlays/DragBar.cs | 4 +++- osu.Game/Overlays/MusicController.cs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/DragBar.cs b/osu.Game/Overlays/DragBar.cs index dc79b1f094..251aed1ee4 100644 --- a/osu.Game/Overlays/DragBar.cs +++ b/osu.Game/Overlays/DragBar.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Transforms; using osu.Framework.Input; +using OpenTK; namespace osu.Game.Overlays { @@ -17,7 +18,7 @@ namespace osu.Game.Overlays public Action SeekRequested; private bool isDragging; - private bool enabled; + private bool enabled = true; public bool IsEnabled { get { return enabled; } @@ -62,6 +63,7 @@ namespace osu.Game.Overlays private void updatePosition(float position) { + position = MathHelper.Clamp(position, 0, 1); fill.TransformTo(fill.Width, position, 100, EasingTypes.OutQuint, new TransformWidth()); } diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 9f3eeb47a0..2fc6922dcf 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -237,7 +237,7 @@ namespace osu.Game.Overlays if (current?.TrackLoaded ?? false) { - progress.UpdatePosition((float)(current.Track.CurrentTime / current.Track.Length)); + progress.UpdatePosition(current.Track.Length == 0 ? 0 : (float)(current.Track.CurrentTime / current.Track.Length)); playButton.Icon = current.Track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o; if (current.Track.HasCompleted && !current.Track.Looping) next(); From fa28e7bdc30b0f41dc4f05b9bbfbce113b7b4df8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 7 Apr 2017 13:04:57 +0900 Subject: [PATCH 03/45] Improve clickability and visuals of MusicController buttons. --- .../Tests/TestCaseMusicController.cs | 4 +- osu.Game/Overlays/MusicController.cs | 185 +++++++++++------- 2 files changed, 121 insertions(+), 68 deletions(-) diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs index c0c17cd50e..5665bf859a 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMusicController.cs @@ -30,7 +30,9 @@ namespace osu.Desktop.VisualTests.Tests Anchor = Anchor.Centre }; Add(mc); - AddToggleStep(@"Show", state => mc.State = state ? Visibility.Visible : Visibility.Hidden); + + AddToggleStep(@"toggle visibility", state => mc.State = state ? Visibility.Visible : Visibility.Hidden); + AddStep(@"show", () => mc.State = Visibility.Visible); } } } diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 2fc6922dcf..fb319d46d5 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -30,7 +30,7 @@ namespace osu.Game.Overlays { private Drawable currentBackground; private DragBar progress; - private TextAwesome playButton; + private Button playButton; private SpriteText title, artist; private List playList; @@ -46,6 +46,8 @@ namespace osu.Game.Overlays private Container dragContainer; + private const float bottom_black_area_height = 50; + public MusicController() { Width = 400; @@ -115,83 +117,46 @@ namespace osu.Game.Overlays Text = @"Nothing to play", Font = @"Exo2.0-BoldItalic" }, - new ClickableContainer + new FillFlowContainer