mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Added muted/unmuted icon
This commit is contained in:
parent
1440edbf8b
commit
a8fb732256
@ -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]
|
||||
|
Loading…
Reference in New Issue
Block a user