2017-05-17 13:54:49 +00:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2017-10-02 01:42:38 +00:00
|
|
|
|
using osu.Framework.Timing;
|
2017-10-02 15:09:00 +00:00
|
|
|
|
using osu.Framework.Configuration;
|
2017-05-18 04:09:36 +00:00
|
|
|
|
|
2017-05-22 06:07:08 +00:00
|
|
|
|
namespace osu.Game.Screens.Play.ReplaySettings
|
2017-05-18 04:09:36 +00:00
|
|
|
|
{
|
2017-06-05 07:47:42 +00:00
|
|
|
|
public class PlaybackSettings : ReplayGroup
|
2017-05-18 04:09:36 +00:00
|
|
|
|
{
|
2017-05-27 21:56:11 +00:00
|
|
|
|
protected override string Title => @"playback";
|
2017-05-18 04:09:36 +00:00
|
|
|
|
|
2017-10-26 12:04:44 +00:00
|
|
|
|
public IAdjustableClock AdjustableClock { set; get; }
|
2017-10-03 17:05:50 +00:00
|
|
|
|
|
2017-10-02 15:09:00 +00:00
|
|
|
|
private readonly ReplaySliderBar<double> sliderbar;
|
2017-10-02 01:42:38 +00:00
|
|
|
|
|
2017-10-02 15:09:00 +00:00
|
|
|
|
public PlaybackSettings()
|
2017-05-18 04:09:36 +00:00
|
|
|
|
{
|
2017-10-02 01:42:38 +00:00
|
|
|
|
Child = sliderbar = new ReplaySliderBar<double>
|
2017-05-18 04:09:36 +00:00
|
|
|
|
{
|
2017-10-02 01:42:38 +00:00
|
|
|
|
LabelText = "Playback speed",
|
2017-10-26 12:18:06 +00:00
|
|
|
|
Bindable = new BindableDouble(1)
|
2017-10-02 15:19:55 +00:00
|
|
|
|
{
|
2017-10-26 12:04:44 +00:00
|
|
|
|
Default = 1,
|
2017-10-02 15:19:55 +00:00
|
|
|
|
MinValue = 0.5,
|
2017-11-11 04:00:29 +00:00
|
|
|
|
MaxValue = 2,
|
|
|
|
|
Precision = 0.01,
|
2017-10-02 15:19:55 +00:00
|
|
|
|
},
|
2017-05-29 16:00:29 +00:00
|
|
|
|
};
|
2017-05-18 04:09:36 +00:00
|
|
|
|
}
|
2017-10-02 01:42:38 +00:00
|
|
|
|
|
2017-10-03 17:05:50 +00:00
|
|
|
|
protected override void LoadComplete()
|
2017-10-02 01:42:38 +00:00
|
|
|
|
{
|
2017-10-03 17:05:50 +00:00
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
2017-10-26 12:04:44 +00:00
|
|
|
|
if (AdjustableClock == null)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var clockRate = AdjustableClock.Rate;
|
|
|
|
|
sliderbar.Bindable.ValueChanged += rateMultiplier => AdjustableClock.Rate = clockRate * rateMultiplier;
|
2017-10-02 01:42:38 +00:00
|
|
|
|
}
|
2017-05-18 04:09:36 +00:00
|
|
|
|
}
|
|
|
|
|
}
|