From ec758379659e83226a63b747173e2cd17fc03205 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 13 Nov 2017 05:04:21 +0300 Subject: [PATCH 1/3] Replay speed setting visual improvements --- .../Play/ReplaySettings/PlaybackSettings.cs | 47 +++++++++++++++---- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index bf2909b8ab..8aaf5b5711 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -3,6 +3,9 @@ using osu.Framework.Timing; using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play.ReplaySettings { @@ -13,19 +16,43 @@ public class PlaybackSettings : ReplayGroup public IAdjustableClock AdjustableClock { set; get; } private readonly ReplaySliderBar sliderbar; + private readonly OsuSpriteText multiplierText; public PlaybackSettings() { - Child = sliderbar = new ReplaySliderBar + Children = new Drawable[] { - LabelText = "Playback speed", - Bindable = new BindableDouble(1) + new Container { - Default = 1, - MinValue = 0.5, - MaxValue = 2, - Precision = 0.01, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Children = new Drawable[] + { + new OsuSpriteText + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + Text = "Playback speed", + }, + multiplierText = new OsuSpriteText + { + Anchor = Anchor.CentreRight, + Origin = Anchor.CentreRight, + Text = "1x", + Font = @"Exo2.0-Bold", + } + }, }, + sliderbar = new ReplaySliderBar + { + Bindable = new BindableDouble(1) + { + Default = 1, + MinValue = 0.5, + MaxValue = 2, + Precision = 0.01, + }, + } }; } @@ -37,7 +64,11 @@ protected override void LoadComplete() return; var clockRate = AdjustableClock.Rate; - sliderbar.Bindable.ValueChanged += rateMultiplier => AdjustableClock.Rate = clockRate * rateMultiplier; + sliderbar.Bindable.ValueChanged += rateMultiplier => + { + AdjustableClock.Rate = clockRate * rateMultiplier; + multiplierText.Text = $"{rateMultiplier}x"; + }; } } } From 89e9f847532d0a8283fada2f568d49b616574a2d Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 13 Nov 2017 05:52:05 +0300 Subject: [PATCH 2/3] Add padding to the text container --- .../Screens/Play/ReplaySettings/PlaybackSettings.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 8aaf5b5711..71526d72ef 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -11,6 +11,8 @@ namespace osu.Game.Screens.Play.ReplaySettings { public class PlaybackSettings : ReplayGroup { + private const int padding = 10; + protected override string Title => @"playback"; public IAdjustableClock AdjustableClock { set; get; } @@ -26,6 +28,7 @@ public PlaybackSettings() { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, + Padding = new MarginPadding { Horizontal = padding }, Children = new Drawable[] { new OsuSpriteText @@ -54,6 +57,8 @@ public PlaybackSettings() }, } }; + + sliderbar.Bindable.ValueChanged += rateMultiplier => multiplierText.Text = $"{rateMultiplier}x"; } protected override void LoadComplete() @@ -64,11 +69,7 @@ protected override void LoadComplete() return; var clockRate = AdjustableClock.Rate; - sliderbar.Bindable.ValueChanged += rateMultiplier => - { - AdjustableClock.Rate = clockRate * rateMultiplier; - multiplierText.Text = $"{rateMultiplier}x"; - }; + sliderbar.Bindable.ValueChanged += rateMultiplier => AdjustableClock.Rate = clockRate * rateMultiplier; } } } From 51adea2a604350e7b66f7dad4c70406a57308ae4 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 13 Nov 2017 05:58:19 +0300 Subject: [PATCH 3/3] Convert text to a local variable --- osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs index 71526d72ef..3109552532 100644 --- a/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/ReplaySettings/PlaybackSettings.cs @@ -18,10 +18,11 @@ public class PlaybackSettings : ReplayGroup public IAdjustableClock AdjustableClock { set; get; } private readonly ReplaySliderBar sliderbar; - private readonly OsuSpriteText multiplierText; public PlaybackSettings() { + OsuSpriteText multiplierText; + Children = new Drawable[] { new Container