mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +08:00
Add OptionsSlider and wire up volume sliders
This commit is contained in:
parent
783ef6829e
commit
a350e95e40
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
@ -14,21 +15,15 @@ namespace osu.Game.Overlays.Options.Audio
|
||||
{
|
||||
protected override string Header => "Volume";
|
||||
|
||||
private CheckBoxOption ignoreHitsounds;
|
||||
|
||||
public VolumeOptions()
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
private void load(OsuConfigManager config, AudioManager audio)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteText { Text = "Master: TODO slider" },
|
||||
new SpriteText { Text = "Music: TODO slider" },
|
||||
new SpriteText { Text = "Effect: TODO slider" },
|
||||
ignoreHitsounds = new CheckBoxOption
|
||||
new OptionsSlider { Label = "Master", Bindable = audio.Volume },
|
||||
new OptionsSlider { Label = "Effect", Bindable = audio.VolumeSample },
|
||||
new OptionsSlider { Label = "Music", Bindable = audio.VolumeTrack },
|
||||
new CheckBoxOption
|
||||
{
|
||||
LabelText = "Ignore beatmap hitsounds",
|
||||
Bindable = config.GetBindable<bool>(OsuConfig.IgnoreBeatmapSamples)
|
||||
|
48
osu.Game/Overlays/Options/OptionsSlider.cs
Normal file
48
osu.Game/Overlays/Options/OptionsSlider.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class OptionsSlider : FlowContainer
|
||||
{
|
||||
private SliderBar slider;
|
||||
private SpriteText text;
|
||||
|
||||
public string Label
|
||||
{
|
||||
get { return text.Text; }
|
||||
set { text.Text = value; }
|
||||
}
|
||||
|
||||
public BindableDouble Bindable
|
||||
{
|
||||
get { return slider.Bindable; }
|
||||
set { slider.Bindable = value; }
|
||||
}
|
||||
|
||||
public OptionsSlider()
|
||||
{
|
||||
Direction = FlowDirection.VerticalOnly;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
text = new SpriteText(),
|
||||
slider = new SliderBar
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
Height = 10,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Color = Color4.White,
|
||||
SelectionColor = new Color4(255, 102, 170, 255),
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -222,6 +222,7 @@
|
||||
<Compile Include="Overlays\Options\CheckBoxOption.cs" />
|
||||
<Compile Include="Overlays\Options\SidebarButton.cs" />
|
||||
<Compile Include="Overlays\Options\TextBoxOption.cs" />
|
||||
<Compile Include="Overlays\Options\OptionsSlider.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||
|
Loading…
Reference in New Issue
Block a user