From a8fb732256d35c18c99cbf902d8b5fe8efe453de Mon Sep 17 00:00:00 2001 From: aQaTL Date: Wed, 17 Jan 2018 20:43:08 +0100 Subject: [PATCH] Added muted/unmuted icon --- .../UserInterface/Volume/VolumeControl.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs index d5645d6f24..2d350a3474 100644 --- a/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs +++ b/osu.Game/Graphics/UserInterface/Volume/VolumeControl.cs @@ -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]