2019-01-24 17:43:03 +09:00
|
|
|
|
// 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
|
|
|
|
|
2019-02-21 19:04:31 +09:00
|
|
|
|
using osu.Framework.Bindables;
|
2017-11-13 05:04:21 +03:00
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-02-12 13:04:46 +09:00
|
|
|
|
using osu.Game.Graphics;
|
2017-11-13 05:04:21 +03:00
|
|
|
|
using osu.Game.Graphics.Sprites;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2018-01-13 22:25:09 +03:00
|
|
|
|
namespace osu.Game.Screens.Play.PlayerSettings
|
2017-05-18 07:09:36 +03:00
|
|
|
|
{
|
2018-01-15 20:52:52 +03:00
|
|
|
|
public partial 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
|
|
|
|
|
2019-03-06 20:30:14 +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
|
|
|
|
|
2019-02-22 17:51:39 +09:00
|
|
|
|
private readonly PlayerSliderBar<double> rateSlider;
|
2018-04-13 18:19:50 +09:00
|
|
|
|
|
2019-01-22 11:40:57 +09:00
|
|
|
|
private readonly OsuSpriteText multiplierText;
|
|
|
|
|
|
2017-10-02 18:09:00 +03:00
|
|
|
|
public PlaybackSettings()
|
2020-09-09 18:48:02 +09:00
|
|
|
|
: base("playback")
|
2017-05-18 07:09:36 +03:00
|
|
|
|
{
|
2017-11-13 05:04:21 +03:00
|
|
|
|
Children = new Drawable[]
|
2017-05-18 07:09:36 +03:00
|
|
|
|
{
|
2017-11-13 05:04:21 +03:00
|
|
|
|
new Container
|
2017-10-02 18:19:55 +03:00
|
|
|
|
{
|
2017-11-13 05:04:21 +03:00
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
AutoSizeAxes = Axes.Y,
|
2017-11-13 05:52:05 +03:00
|
|
|
|
Padding = new MarginPadding { Horizontal = padding },
|
2017-11-13 05:04:21 +03:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreLeft,
|
|
|
|
|
Origin = Anchor.CentreLeft,
|
|
|
|
|
Text = "Playback speed",
|
|
|
|
|
},
|
|
|
|
|
multiplierText = new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
2019-02-12 13:04:46 +09:00
|
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
2017-11-13 05:04:21 +03:00
|
|
|
|
}
|
|
|
|
|
},
|
2017-10-02 18:19:55 +03:00
|
|
|
|
},
|
2020-10-06 17:18:41 +09: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();
|
2020-10-06 17:18:41 +09:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|