<commit_before>﻿// Copyright (c) 2007-2017 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using osu.Framework.Timing;
using osu.Framework.Configuration;

namespace osu.Game.Screens.Play.ReplaySettings
{
    public class PlaybackSettings : ReplayGroup
    {
        protected override string Title => @"playback";

        public IAdjustableClock AdjustableClock { set; get; }

        private readonly ReplaySliderBar<double> sliderbar;

        public PlaybackSettings()
        {
            Child = sliderbar = new ReplaySliderBar<double>
            {
                LabelText = "Playback speed",
                Bindable = new BindableDouble(1)
                {
                    Default = 1,
                    MinValue = 0.5,
                    MaxValue = 2,
                    Precision = 0.01,
                },
            };
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();

            if (AdjustableClock == null)
                return;

            var clockRate = AdjustableClock.Rate;
            sliderbar.Bindable.ValueChanged += rateMultiplier => AdjustableClock.Rate = clockRate * rateMultiplier;
        }
    }
}<commit_msg>Replay speed setting visual improvements<commit_after>﻿// Copyright (c) 2007-2017 ppy Pty Ltd <<EMAIL>>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

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
{
    public class PlaybackSettings : ReplayGroup
    {
        protected override string Title => @"playback";

        public IAdjustableClock AdjustableClock { set; get; }

        private readonly ReplaySliderBar<double> sliderbar;
        private readonly OsuSpriteText multiplierText;

        public PlaybackSettings()
        {
            Children = new Drawable[]
            {
                new Container
                {
                    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<double>
                {
                    Bindable = new BindableDouble(1)
                    {
                        Default = 1,
                        MinValue = 0.5,
                        MaxValue = 2,
                        Precision = 0.01,
                    },
                }
            };
        }

        protected override void LoadComplete()
        {
            base.LoadComplete();

            if (AdjustableClock == null)
                return;

            var clockRate = AdjustableClock.Rate;
            sliderbar.Bindable.ValueChanged += rateMultiplier =>
            {
                AdjustableClock.Rate = clockRate * rateMultiplier;
                multiplierText.Text = $"{rateMultiplier}x";
            };
        }
    }
}
{'fraction_non_alphanumeric': 0.07872111767866738, 'fraction_numerical': 0.009403546480386889, 'mean_word_length': 1.2687385740402193, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6537683', 'n_tokens_mistral': 981, 'n_tokens_neox': 895, 'n_words': 194}