1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +08:00

Added muted/unmuted icon

This commit is contained in:
aQaTL 2018-01-17 20:43:08 +01:00
parent 1440edbf8b
commit a8fb732256
No known key found for this signature in database
GPG Key ID: 181719411A8555F0

View File

@ -17,6 +17,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
private AudioManager audio;
private readonly VolumeMeter volumeMeterMaster;
private readonly IconButton muteIcon;
protected override bool BlockPassThroughMouse => false;
@ -37,12 +38,23 @@ namespace osu.Game.Graphics.UserInterface.Volume
Spacing = new Vector2(15, 0),
Children = new Drawable[]
{
muteIcon = new IconButton(),
volumeMeterMaster = new VolumeMeter("Master"),
volumeMeterEffect = new VolumeMeter("Effects"),
volumeMeterMusic = new VolumeMeter("Music")
}
}
};
muteIcon.Icon = FontAwesome.fa_volume_up;
muteIcon.Scale = new Vector2(2.0f);
muteIcon.Action = () =>
{
if (IsMuted)
Unmute();
else
Mute();
};
}
protected override void LoadComplete()
@ -80,6 +92,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
volumeMeterMaster.Increase();
return true;
case GlobalAction.ToggleMute:
if (State == Visibility.Hidden)
Show();
if (IsMuted)
Unmute();
else
@ -107,6 +121,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
audio.AddAdjustment(AdjustableProperty.Volume, muteBindable);
IsMuted = true;
muteIcon.Icon = FontAwesome.fa_volume_off;
}
public void Unmute()
@ -116,6 +131,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
audio.RemoveAdjustment(AdjustableProperty.Volume, muteBindable);
IsMuted = false;
muteIcon.Icon = FontAwesome.fa_volume_up;
}
[BackgroundDependencyLoader]