1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 07:22:55 +08:00

Add replay speed adjustment

This commit is contained in:
EVAST9919 2017-10-02 04:42:38 +03:00
parent cecfd7b0f3
commit 6d97da8b19
4 changed files with 32 additions and 17 deletions

View File

@ -32,6 +32,7 @@ namespace osu.Game.Screens.Play
public readonly HealthDisplay HealthDisplay;
public readonly SongProgress Progress;
public readonly ModDisplay ModDisplay;
public readonly ReplaySettingsOverlay ReplaySettingsOverlay;
private Bindable<bool> showHud;
private bool replayLoaded;
@ -55,7 +56,7 @@ namespace osu.Game.Screens.Play
HealthDisplay = CreateHealthDisplay(),
Progress = CreateProgress(),
ModDisplay = CreateModsContainer(),
//ReplaySettingsOverlay = CreateReplaySettingsOverlay(),
ReplaySettingsOverlay = CreateReplaySettingsOverlay(),
}
});
}
@ -98,7 +99,10 @@ namespace osu.Game.Screens.Play
// in the case a replay isn't loaded, we want some elements to only appear briefly.
if (!replayLoaded)
{
ReplaySettingsOverlay.Hide();
ModDisplay.Delay(2000).FadeOut(200);
}
}
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
@ -176,12 +180,12 @@ namespace osu.Game.Screens.Play
Margin = new MarginPadding { Top = 20, Right = 10 },
};
//protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay
//{
// Anchor = Anchor.TopRight,
// Origin = Anchor.TopRight,
// Margin = new MarginPadding { Top = 100, Right = 10 },
//};
protected virtual ReplaySettingsOverlay CreateReplaySettingsOverlay() => new ReplaySettingsOverlay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Margin = new MarginPadding { Top = 100, Right = 10 },
};
public virtual void BindProcessor(ScoreProcessor processor)
{

View File

@ -222,6 +222,8 @@ namespace osu.Game.Screens.Play
hudOverlay.ModDisplay.Current.BindTo(working.Mods);
hudOverlay.ReplaySettingsOverlay.PlaybackSettings.BindClock(adjustableSourceClock);
// Bind ScoreProcessor to ourselves
scoreProcessor.AllJudged += onCompletion;
scoreProcessor.Failed += onFail;

View File

@ -3,7 +3,7 @@
using osu.Framework.Allocation;
using osu.Game.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Timing;
namespace osu.Game.Screens.Play.ReplaySettings
{
@ -11,17 +11,24 @@ namespace osu.Game.Screens.Play.ReplaySettings
{
protected override string Title => @"playback";
private ReplaySliderBar<double> sliderbar;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)
{
Children = new Drawable[]
Child = sliderbar = new ReplaySliderBar<double>
{
new ReplaySliderBar<double>
{
LabelText = "Playback speed",
Bindable = config.GetBindable<double>(OsuSetting.PlaybackSpeed)
}
LabelText = "Playback speed",
Bindable = config.GetBindable<double>(OsuSetting.PlaybackSpeed),
};
}
public void BindClock(IAdjustableClock clock)
{
var clockRate = clock.Rate;
sliderbar.Bindable.ValueChanged += (rateMultiplier) => clock.Rate = clockRate * rateMultiplier;
sliderbar.Bindable.Value = 1;
}
}
}

View File

@ -10,15 +10,17 @@ namespace osu.Game.Screens.Play
{
public class ReplaySettingsOverlay : FillFlowContainer
{
public readonly PlaybackSettings PlaybackSettings;
public ReplaySettingsOverlay()
{
Direction = FillDirection.Vertical;
AutoSizeAxes = Axes.Both;
Spacing = new Vector2(0, 20);
Add(new CollectionSettings());
Add(new DiscussionSettings());
Add(new PlaybackSettings());
//Add(new CollectionSettings());
//Add(new DiscussionSettings());
Add(PlaybackSettings = new PlaybackSettings());
}
}
}