Round end audio (#8048)

This commit is contained in:
metalgearsloth
2022-05-13 10:13:07 +10:00
committed by GitHub
parent 5fe643f900
commit 798af00ad2
8 changed files with 40 additions and 5 deletions

View File

@@ -70,15 +70,18 @@ namespace Content.Client.Audio
private void StateManagerOnStateChanged(StateChangedEventArgs args)
{
EndAmbience();
EndLobbyMusic();
if (args.NewState is LobbyState && _configManager.GetCVar(CCVars.LobbyMusicEnabled))
{
StartLobbyMusic();
return;
}
else if (args.NewState is GameScreen)
{
StartAmbience();
}
EndLobbyMusic();
}
private void OnJoin(object? sender, PlayerEventArgs args)
@@ -156,9 +159,17 @@ namespace Content.Client.Audio
StartLobbyMusic();
}
}
private void StartLobbyMusic()
public void RestartLobbyMusic()
{
EndLobbyMusic();
StartLobbyMusic();
}
public void StartLobbyMusic()
{
if (_lobbyStream != null) return;
var file = _gameTicker.LobbySong;
if (file == null) // We have not received the lobby song yet.
{