2018-01-09 23:24:51 +00:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Timing;
|
|
|
|
|
using osu.Game.Configuration;
|
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
using osu.Game.Screens.Play.ReplaySettings;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Play.HUD
|
|
|
|
|
{
|
|
|
|
|
public class VisualSettings : ReplayGroup
|
|
|
|
|
{
|
|
|
|
|
protected override string Title => "Visual settings";
|
2018-01-10 22:24:34 +00:00
|
|
|
|
|
|
|
|
|
public IAdjustableClock AudioClock { get; set; }
|
|
|
|
|
public FramedClock FramedClock { get; set; }
|
2018-01-09 23:24:51 +00:00
|
|
|
|
|
|
|
|
|
private readonly ReplaySliderBar<double> dimSliderBar;
|
|
|
|
|
private readonly ReplayCheckbox showStoryboardToggle;
|
|
|
|
|
private readonly ReplayCheckbox mouseWheelDisabledToggle;
|
|
|
|
|
|
|
|
|
|
public VisualSettings()
|
|
|
|
|
{
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "Background dim:"
|
|
|
|
|
},
|
|
|
|
|
dimSliderBar = new ReplaySliderBar<double>(),
|
|
|
|
|
new OsuSpriteText
|
|
|
|
|
{
|
|
|
|
|
Text = "Toggles:"
|
|
|
|
|
},
|
|
|
|
|
showStoryboardToggle = new ReplayCheckbox {LabelText = "Storyboards" },
|
|
|
|
|
mouseWheelDisabledToggle = new ReplayCheckbox { LabelText = "Disable mouse wheel" }
|
|
|
|
|
};
|
|
|
|
|
ToggleContentVisibility();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuConfigManager config)
|
|
|
|
|
{
|
|
|
|
|
dimSliderBar.Bindable = config.GetBindable<double>(OsuSetting.DimLevel);
|
|
|
|
|
showStoryboardToggle.Bindable = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
|
|
|
|
mouseWheelDisabledToggle.Bindable = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override void ToggleContentVisibility()
|
|
|
|
|
{
|
|
|
|
|
base.ToggleContentVisibility();
|
|
|
|
|
if (Expanded)
|
2018-01-10 22:24:34 +00:00
|
|
|
|
{
|
|
|
|
|
AudioClock?.Stop();
|
|
|
|
|
if (FramedClock != null)
|
|
|
|
|
FramedClock.ProcessSourceClockFrames = false;
|
|
|
|
|
}
|
2018-01-09 23:24:51 +00:00
|
|
|
|
else
|
2018-01-10 22:24:34 +00:00
|
|
|
|
{
|
|
|
|
|
AudioClock?.Start();
|
|
|
|
|
if (FramedClock != null)
|
|
|
|
|
FramedClock.ProcessSourceClockFrames = true;
|
|
|
|
|
}
|
2018-01-09 23:24:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|