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

Fix test regressions

This commit is contained in:
Dean Herbert 2019-09-27 13:20:17 +08:00
parent b50ef8ffa4
commit f4f5a7e9c8

View File

@ -59,17 +59,6 @@ namespace osu.Game.Screens.Play
private IdleTracker idleTracker; private IdleTracker idleTracker;
[Resolved(CanBeNull = true)]
private NotificationOverlay notificationOverlay { get; set; }
[Resolved]
private VolumeOverlay volumeOverlay { get; set; }
[Resolved]
private AudioManager audioManager { get; set; }
private static bool muteWarningShownOnce;
public PlayerLoader(Func<Player> createPlayer) public PlayerLoader(Func<Player> createPlayer)
{ {
this.createPlayer = createPlayer; this.createPlayer = createPlayer;
@ -159,10 +148,24 @@ namespace osu.Game.Screens.Play
content.FadeOut(250); content.FadeOut(250);
} }
private void checkVolume(AudioManager audio) [Resolved(CanBeNull = true)]
private NotificationOverlay notificationOverlay { get; set; }
[Resolved(CanBeNull = true)]
private VolumeOverlay volumeOverlay { get; set; }
[Resolved]
private AudioManager audioManager { get; set; }
private static bool muteWarningShownOnce;
private void checkVolume()
{ {
if (muteWarningShownOnce)
return;
//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. //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)) if (volumeOverlay?.IsMuted.Value == true || audioManager.Volume.Value <= audioManager.Volume.MinValue || audioManager.VolumeTrack.Value <= audioManager.VolumeTrack.MinValue)
{ {
notificationOverlay?.Post(new MutedNotification()); notificationOverlay?.Post(new MutedNotification());
muteWarningShownOnce = true; muteWarningShownOnce = true;
@ -213,7 +216,8 @@ namespace osu.Game.Screens.Play
{ {
inputManager = GetContainingInputManager(); inputManager = GetContainingInputManager();
base.LoadComplete(); base.LoadComplete();
checkVolume(audioManager);
checkVolume();
} }
private ScheduledDelegate pushDebounce; private ScheduledDelegate pushDebounce;