diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index 26a8e7bf4f..364ef1c7aa 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -19,9 +19,6 @@ namespace osu.Game.Graphics.UserInterface.Volume private VolumeMeter volumeMeterMaster; - private FlowContainer content; - protected override Container Content => content; - private void volumeChanged(object sender, EventArgs e) { Show(); @@ -34,14 +31,23 @@ namespace osu.Game.Graphics.UserInterface.Volume Anchor = Anchor.BottomRight; Origin = Anchor.BottomRight; - AddInternal(content = new FlowContainer + Children = new Drawable[] { - AutoSizeAxes = Axes.Both, - Anchor = Anchor.BottomRight, - Origin = Anchor.BottomRight, - Margin = new MarginPadding { Left = 10, Right = 10, Top = 30, Bottom = 30 }, - Spacing = new Vector2(15, 0), - }); + new FlowContainer + { + AutoSizeAxes = Axes.Both, + Anchor = Anchor.BottomRight, + Origin = Anchor.BottomRight, + Margin = new MarginPadding { Left = 10, Right = 10, Top = 30, Bottom = 30 }, + Spacing = new Vector2(15, 0), + Children = new Drawable[] + { + volumeMeterMaster = new VolumeMeter("Master"), + volumeMeterEffect = new VolumeMeter("Effects"), + volumeMeterMusic = new VolumeMeter("Music") + } + } + }; } protected override void LoadComplete() @@ -52,12 +58,9 @@ namespace osu.Game.Graphics.UserInterface.Volume VolumeSample.ValueChanged += volumeChanged; VolumeTrack.ValueChanged += volumeChanged; - Add(new[] - { - volumeMeterMaster = new VolumeMeter("Master", VolumeGlobal), - new VolumeMeter("Effects", VolumeSample), - new VolumeMeter("Music", VolumeTrack) - }); + volumeMeterMaster.Bindable = VolumeGlobal; + volumeMeterEffect.Bindable = VolumeSample; + volumeMeterMusic.Bindable = VolumeTrack; } protected override void Dispose(bool isDisposing) @@ -81,6 +84,9 @@ namespace osu.Game.Graphics.UserInterface.Volume ScheduledDelegate popOutDelegate; + private VolumeMeter volumeMeterEffect; + private VolumeMeter volumeMeterMusic; + protected override void PopIn() { ClearTransformations(); diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs index 4cba437883..f13019e72c 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeMeter.cs @@ -13,11 +13,10 @@ namespace osu.Game.Graphics.UserInterface.Volume internal class VolumeMeter : Container { private Box meterFill; - private BindableDouble volume; + public BindableDouble Bindable; - public VolumeMeter(string meterName, BindableDouble volume) + public VolumeMeter(string meterName) { - this.volume = volume; Size = new Vector2(40, 180); Children = new Drawable[] { @@ -65,10 +64,10 @@ namespace osu.Game.Graphics.UserInterface.Volume public double Volume { - get { return volume.Value; } + get { return Bindable.Value; } private set { - volume.Value = value; + Bindable.Value = value; updateFill(); } }