osu/osu.Game/Screens/Play/HUD/VisualSettings.cs

69 lines
2.4 KiB
C#
Raw Normal View History

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";
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)
{
AudioClock?.Stop();
if (FramedClock != null)
FramedClock.ProcessSourceClockFrames = false;
}
2018-01-09 23:24:51 +00:00
else
{
AudioClock?.Start();
if (FramedClock != null)
FramedClock.ProcessSourceClockFrames = true;
}
2018-01-09 23:24:51 +00:00
}
}
}