Misc replay related changes (#17102)

This commit is contained in:
Leon Friedrich
2023-06-05 16:33:49 +12:00
committed by GitHub
parent 7d178555e1
commit a8eee5878a
14 changed files with 132 additions and 75 deletions

View File

@@ -21,11 +21,18 @@ namespace Content.Client.GameTicking.Managers
[Dependency] private readonly IStateManager _stateManager = default!;
[Dependency] private readonly IEntityManager _entityManager = default!;
[Dependency] private readonly IConfigurationManager _configManager = default!;
[Dependency] private readonly BackgroundAudioSystem _backgroundAudio = default!;
[Dependency] private readonly SharedAudioSystem _audio = default!;
[ViewVariables] private bool _initialized;
private Dictionary<EntityUid, Dictionary<string, uint?>> _jobsAvailable = new();
private Dictionary<EntityUid, string> _stationNames = new();
/// <summary>
/// The current round-end window. Could be used to support re-opening the window after closing it.
/// </summary>
private RoundEndSummaryWindow? _window;
[ViewVariables] public bool AreWeReady { get; private set; }
[ViewVariables] public bool IsGameStarted { get; private set; }
[ViewVariables] public string? LobbySong { get; private set; }
@@ -127,13 +134,17 @@ namespace Content.Client.GameTicking.Managers
if (message.LobbySong != null)
{
LobbySong = message.LobbySong;
Get<BackgroundAudioSystem>().StartLobbyMusic();
_backgroundAudio.StartLobbyMusic();
}
RestartSound = message.RestartSound;
// Don't open duplicate windows (mainly for replays).
if (_window?.RoundId == message.RoundId)
return;
//This is not ideal at all, but I don't see an immediately better fit anywhere else.
var roundEnd = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, _entityManager);
_window = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, _entityManager);
}
private void RoundRestartCleanup(RoundRestartCleanupEvent ev)
@@ -147,7 +158,7 @@ namespace Content.Client.GameTicking.Managers
return;
}
SoundSystem.Play(RestartSound, Filter.Empty());
_audio.PlayGlobal(RestartSound, Filter.Local(), false);
// Cleanup the sound, we only want it to play when the round restarts after it ends normally.
RestartSound = null;