1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Merge pull request #660 from peppy/audio-offset

Add basic UO support (now called Audio Offset).
This commit is contained in:
Dan Balasescu 2017-04-21 19:07:04 +09:00 committed by GitHub
commit ed5f072151
3 changed files with 22 additions and 8 deletions

View File

@ -38,6 +38,8 @@ namespace osu.Game.Configuration
Set(OsuConfig.KeyOverlay, false);
//todo: implement all settings below this line (remove the Disabled set when doing so).
Set(OsuConfig.AudioOffset, 0, -500.0, 500.0);
Set(OsuConfig.MouseSpeed, 1.0).Disabled = true;
Set(OsuConfig.BeatmapDirectory, @"Songs").Disabled = true; // TODO: use thi.Disabled = trues
Set(OsuConfig.AllowPublicInvites, true).Disabled = true;
@ -103,7 +105,6 @@ namespace osu.Game.Configuration
Set(OsuConfig.ManiaSpeedBPMScale, true).Disabled = true;
Set(OsuConfig.MenuTip, 0).Disabled = true;
Set(OsuConfig.MouseSpeed, 1, 0.4, 6).Disabled = true;
Set(OsuConfig.Offset, 0, -300, 300).Disabled = true;
Set(OsuConfig.ScoreMeterScale, 1, 0.5, 2).Disabled = true;
//Set(OsuConfig.ScoreMeterScale, 1, 0.5, OsuGame.Tournament ? 10 : 2).Disabled = true;
Set(OsuConfig.DistanceSpacing, 0.8, 0.1, 6).Disabled = true;
@ -270,7 +271,7 @@ namespace osu.Game.Configuration
MouseDisableButtons,
MouseDisableWheel,
MouseSpeed,
Offset,
AudioOffset,
ScoreMeterScale,
DistanceSpacing,
EditorBeatDivisor,

View File

@ -18,10 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio
{
Children = new Drawable[]
{
new OptionSlider<int>
new OptionSlider<double>
{
LabelText = "Universal Offset",
Bindable = (BindableInt)config.GetBindable<int>(OsuConfig.Offset)
LabelText = "Audio Offset",
Bindable = (BindableDouble)config.GetBindable<double>(OsuConfig.AudioOffset)
},
new OsuButton
{

View File

@ -49,13 +49,22 @@ namespace osu.Game.Screens.Play
private bool canPause => ValidForResume && !HasFailed && Time.Current >= lastPauseActionTime + pause_cooldown;
private IAdjustableClock sourceClock;
private OffsetClock offsetClock;
private IFrameBasedClock interpolatedSourceClock;
private RulesetInfo ruleset;
private ScoreProcessor scoreProcessor;
protected HitRenderer HitRenderer;
#region User Settings
private Bindable<int> dimLevel;
private Bindable<bool> mouseWheelDisabled;
private Bindable<double> userAudioOffset;
#endregion
private SkipButton skipButton;
private HudOverlay hudOverlay;
@ -115,7 +124,13 @@ namespace osu.Game.Screens.Play
}
sourceClock = (IAdjustableClock)track ?? new StopwatchClock();
interpolatedSourceClock = new InterpolatingFramedClock(sourceClock);
offsetClock = new OffsetClock(sourceClock);
userAudioOffset = config.GetBindable<double>(OsuConfig.AudioOffset);
userAudioOffset.ValueChanged += v => offsetClock.Offset = v;
userAudioOffset.TriggerChange();
interpolatedSourceClock = new InterpolatingFramedClock(offsetClock);
Schedule(() =>
{
@ -360,8 +375,6 @@ namespace osu.Game.Screens.Play
Background?.FadeTo(1f, fade_out_duration);
}
private Bindable<bool> mouseWheelDisabled;
protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused;
}
}