1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 02:22:59 +08:00

Make notification only show up once per session

This commit is contained in:
Craftplacer 2019-09-15 17:20:07 +02:00
parent 08ab4e508f
commit ec788ac09d

View File

@ -66,6 +66,8 @@ namespace osu.Game.Screens.Play
[Resolved]
private VolumeOverlay volumeOverlay { get; set; }
private bool muteWarningShownOnce = false;
public PlayerLoader(Func<Player> createPlayer)
{
this.createPlayer = createPlayer;
@ -159,8 +161,12 @@ namespace osu.Game.Screens.Play
private void checkVolume(AudioManager audio)
{
if (volumeOverlay.IsMuted.Value || audio.Volume.Value <= audio.Volume.MinValue || audio.VolumeTrack.Value <= audio.VolumeTrack.MinValue)
//Checks if the notification has not been shown yet and also if master volume is muted, track/music volume is muted or if the whole game is muted.
if (!muteWarningShownOnce && (volumeOverlay.IsMuted.Value || audio.Volume.Value <= audio.Volume.MinValue || audio.VolumeTrack.Value <= audio.VolumeTrack.MinValue))
{
notificationOverlay.Post(new MutedNotification());
muteWarningShownOnce = true;
}
}
public override void OnEntering(IScreen last)