Fix mute button not prolonging volume control display

This commit is contained in:
Dean Herbert
2018-01-31 18:00:44 +09:00
parent 93ffa1f8a2
commit 47b92f3d1d

View File

@ -59,18 +59,10 @@ namespace osu.Game.Graphics.UserInterface.Volume
{ {
base.LoadComplete(); base.LoadComplete();
volumeMeterMaster.Bindable.ValueChanged += volumeChanged; volumeMeterMaster.Bindable.ValueChanged += _ => settingChanged();
volumeMeterEffect.Bindable.ValueChanged += volumeChanged; volumeMeterEffect.Bindable.ValueChanged += _ => settingChanged();
volumeMeterMusic.Bindable.ValueChanged += volumeChanged; volumeMeterMusic.Bindable.ValueChanged += _ => settingChanged();
} muted.ValueChanged += _ => settingChanged();
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
volumeMeterMaster.Bindable.ValueChanged -= volumeChanged;
volumeMeterEffect.Bindable.ValueChanged -= volumeChanged;
volumeMeterMusic.Bindable.ValueChanged -= volumeChanged;
} }
public bool Adjust(GlobalAction action) public bool Adjust(GlobalAction action)
@ -98,13 +90,13 @@ namespace osu.Game.Graphics.UserInterface.Volume
return false; return false;
} }
private void volumeChanged(double newVolume) private void settingChanged()
{ {
Show(); Show();
schedulePopOut(); schedulePopOut();
} }
private readonly BindableDouble muteBindable = new BindableDouble(); private readonly BindableDouble muteAdjustment = new BindableDouble();
private readonly BindableBool muted = new BindableBool(); private readonly BindableBool muted = new BindableBool();
@ -119,12 +111,12 @@ namespace osu.Game.Graphics.UserInterface.Volume
{ {
if (mute) if (mute)
{ {
audio.AddAdjustment(AdjustableProperty.Volume, muteBindable); audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment);
muteIcon.Icon = FontAwesome.fa_volume_off; muteIcon.Icon = FontAwesome.fa_volume_off;
} }
else else
{ {
audio.RemoveAdjustment(AdjustableProperty.Volume, muteBindable); audio.RemoveAdjustment(AdjustableProperty.Volume, muteAdjustment);
muteIcon.Icon = FontAwesome.fa_volume_up; muteIcon.Icon = FontAwesome.fa_volume_up;
} }
}; };