From 6d91889ca641258a9706c932d16d2aa836a8ba80 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 8 Mar 2018 22:16:47 +0900 Subject: [PATCH] Move player-specific configuration bindables back to player --- osu.Game/Screens/Play/Player.cs | 16 ++++++++++++---- .../Screens/Play/ScreenWithBeatmapBackground.cs | 6 ------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 9b341fbfe5..d24ed53518 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -7,6 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; @@ -16,6 +17,7 @@ using osu.Framework.Threading; using osu.Framework.Timing; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Cursor; using osu.Game.Online.API; @@ -43,6 +45,9 @@ public class Player : ScreenWithBeatmapBackground, IProvideCursor public bool AllowLeadIn { get; set; } = true; public bool AllowResults { get; set; } = true; + private Bindable mouseWheelDisabled; + private Bindable userAudioOffset; + public int RestartCount; public CursorContainer Cursor => RulesetContainer.Cursor; @@ -75,11 +80,14 @@ public class Player : ScreenWithBeatmapBackground, IProvideCursor private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true; [BackgroundDependencyLoader] - private void load(AudioManager audio, APIAccess api) + private void load(AudioManager audio, APIAccess api, OsuConfigManager config) { this.api = api; sampleRestart = audio.Sample.Get(@"Gameplay/restart"); + mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); + userAudioOffset = config.GetBindable(OsuSetting.AudioOffset); + WorkingBeatmap working = Beatmap.Value; Beatmap beatmap; @@ -131,8 +139,8 @@ private void load(AudioManager audio, APIAccess api) // the final usable gameplay clock with user-set offsets applied. var offsetClock = new FramedOffsetClock(adjustableClock); - UserAudioOffset.ValueChanged += v => offsetClock.Offset = v; - UserAudioOffset.TriggerChange(); + userAudioOffset.ValueChanged += v => offsetClock.Offset = v; + userAudioOffset.TriggerChange(); scoreProcessor = RulesetContainer.CreateScoreProcessor(); @@ -342,7 +350,7 @@ private void fadeOut() Background?.FadeTo(1f, fade_out_duration); } - protected override bool OnWheel(InputState state) => MouseWheelDisabled.Value && !pauseContainer.IsPaused; + protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; private void initializeStoryboard(bool asyncLoad) { diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 9942bf4ef5..8e963a94a8 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -26,8 +26,6 @@ public abstract class ScreenWithBeatmapBackground : OsuScreen protected Bindable DimLevel; protected Bindable BlurLevel; protected Bindable ShowStoryboard; - protected Bindable MouseWheelDisabled; - protected Bindable UserAudioOffset; #endregion @@ -37,10 +35,6 @@ private void load(OsuConfigManager config) DimLevel = config.GetBindable(OsuSetting.DimLevel); BlurLevel = config.GetBindable(OsuSetting.BlurLevel); ShowStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); - - MouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); - - UserAudioOffset = config.GetBindable(OsuSetting.AudioOffset); } protected override void OnEntering(Screen last)