1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 18:27:18 +08:00

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
2.1 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 18:19:50 +09:00
2022-06-17 16:37:17 +09:00
#nullable disable
2019-02-21 19:04:31 +09:00
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
2018-04-13 18:19:50 +09:00
namespace osu.Game.Screens.Play.PlayerSettings
2017-05-18 07:09:36 +03:00
{
2018-01-15 20:52:52 +03:00
public class PlaybackSettings : PlayerSettingsGroup
2017-05-18 07:09:36 +03:00
{
2017-11-13 05:52:05 +03:00
private const int padding = 10;
2018-04-13 18:19:50 +09:00
public readonly Bindable<double> UserPlaybackRate = new BindableDouble(1)
{
MinValue = 0.5,
MaxValue = 2,
Precision = 0.1,
};
2018-04-13 18:19:50 +09:00
private readonly PlayerSliderBar<double> rateSlider;
2018-04-13 18:19:50 +09:00
private readonly OsuSpriteText multiplierText;
public PlaybackSettings()
: base("playback")
2017-05-18 07:09:36 +03:00
{
Children = new Drawable[]
2017-05-18 07:09:36 +03:00
{
new Container
2017-10-02 18:19:55 +03:00
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
2017-11-13 05:52:05 +03:00
Padding = new MarginPadding { Horizontal = padding },
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Text = "Playback speed",
},
multiplierText = new OsuSpriteText
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Font = OsuFont.GetFont(weight: FontWeight.Bold),
}
},
2017-10-02 18:19:55 +03:00
},
rateSlider = new PlayerSliderBar<double> { Current = UserPlaybackRate }
2017-05-29 19:00:29 +03:00
};
2017-05-18 07:09:36 +03:00
}
2018-04-13 18:19:50 +09:00
2017-10-03 20:05:50 +03:00
protected override void LoadComplete()
2017-10-02 04:42:38 +03:00
{
2017-10-03 20:05:50 +03:00
base.LoadComplete();
rateSlider.Current.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier.NewValue:0.0}x", true);
2017-10-02 04:42:38 +03:00
}
2017-05-18 07:09:36 +03:00
}
}