Move player-specific configuration bindables back to player

This commit is contained in:
Dean Herbert 2018-03-08 22:16:47 +09:00
parent 2cb197d0c4
commit 6d91889ca6
2 changed files with 12 additions and 10 deletions

View File

@ -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<bool> mouseWheelDisabled;
private Bindable<double> 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<bool>(OsuSetting.MouseDisableWheel);
userAudioOffset = config.GetBindable<double>(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)
{

View File

@ -26,8 +26,6 @@ public abstract class ScreenWithBeatmapBackground : OsuScreen
protected Bindable<double> DimLevel;
protected Bindable<double> BlurLevel;
protected Bindable<bool> ShowStoryboard;
protected Bindable<bool> MouseWheelDisabled;
protected Bindable<double> UserAudioOffset;
#endregion
@ -37,10 +35,6 @@ private void load(OsuConfigManager config)
DimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
BlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
MouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
UserAudioOffset = config.GetBindable<double>(OsuSetting.AudioOffset);
}
protected override void OnEntering(Screen last)