1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 21:03:08 +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 AudioManager audio;
private readonly VolumeMeter volumeMeterMaster; private readonly VolumeMeter volumeMeterMaster;
private readonly IconButton muteIcon;
protected override bool BlockPassThroughMouse => false; protected override bool BlockPassThroughMouse => false;
@ -37,12 +38,23 @@ namespace osu.Game.Graphics.UserInterface.Volume
Spacing = new Vector2(15, 0), Spacing = new Vector2(15, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
muteIcon = new IconButton(),
volumeMeterMaster = new VolumeMeter("Master"), volumeMeterMaster = new VolumeMeter("Master"),
volumeMeterEffect = new VolumeMeter("Effects"), volumeMeterEffect = new VolumeMeter("Effects"),
volumeMeterMusic = new VolumeMeter("Music") 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() protected override void LoadComplete()
@ -80,6 +92,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
volumeMeterMaster.Increase(); volumeMeterMaster.Increase();
return true; return true;
case GlobalAction.ToggleMute: case GlobalAction.ToggleMute:
if (State == Visibility.Hidden)
Show();
if (IsMuted) if (IsMuted)
Unmute(); Unmute();
else else
@ -107,6 +121,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
audio.AddAdjustment(AdjustableProperty.Volume, muteBindable); audio.AddAdjustment(AdjustableProperty.Volume, muteBindable);
IsMuted = true; IsMuted = true;
muteIcon.Icon = FontAwesome.fa_volume_off;
} }
public void Unmute() public void Unmute()
@ -116,6 +131,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
audio.RemoveAdjustment(AdjustableProperty.Volume, muteBindable); audio.RemoveAdjustment(AdjustableProperty.Volume, muteBindable);
IsMuted = false; IsMuted = false;
muteIcon.Icon = FontAwesome.fa_volume_up;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]