From 5fdc9819cf6bcd72f0cceab0a5d02653843dbd9f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 21 Apr 2017 16:19:40 +0900 Subject: [PATCH] Add basic UO support (now called Audio Offset). --- osu.Game/Configuration/OsuConfigManager.cs | 5 +++-- .../Options/Sections/Audio/OffsetOptions.cs | 6 +++--- osu.Game/Screens/Play/Player.cs | 19 ++++++++++++++++--- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index a31c1f882d..d47ed48e99 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -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, diff --git a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs index 2602565c29..c1f5359585 100644 --- a/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs +++ b/osu.Game/Overlays/Options/Sections/Audio/OffsetOptions.cs @@ -18,10 +18,10 @@ namespace osu.Game.Overlays.Options.Sections.Audio { Children = new Drawable[] { - new OptionSlider + new OptionSlider { - LabelText = "Universal Offset", - Bindable = (BindableInt)config.GetBindable(OsuConfig.Offset) + LabelText = "Audio Offset", + Bindable = (BindableDouble)config.GetBindable(OsuConfig.AudioOffset) }, new OsuButton { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5502723c0d..2fcc51d3fd 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -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 dimLevel; + private Bindable mouseWheelDisabled; + private Bindable 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(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 mouseWheelDisabled; - protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused; } }