Make lobby song update occur at round end (#19303)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using Content.Client.Audio;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Lobby;
|
||||
using Content.Client.RoundEnd;
|
||||
@@ -8,7 +7,6 @@ using Content.Shared.GameWindow;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.State;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Player;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -21,7 +19,6 @@ 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;
|
||||
@@ -49,6 +46,7 @@ namespace Content.Client.GameTicking.Managers
|
||||
|
||||
public event Action? InfoBlobUpdated;
|
||||
public event Action? LobbyStatusUpdated;
|
||||
public event Action? LobbySongUpdated;
|
||||
public event Action? LobbyLateJoinStatusUpdated;
|
||||
public event Action<IReadOnlyDictionary<EntityUid, Dictionary<string, uint?>>>? LobbyJobsAvailableUpdated;
|
||||
|
||||
@@ -73,6 +71,16 @@ namespace Content.Client.GameTicking.Managers
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
public void SetLobbySong(string? song, bool forceUpdate = false)
|
||||
{
|
||||
var updated = song != LobbySong;
|
||||
|
||||
LobbySong = song;
|
||||
|
||||
if (updated || forceUpdate)
|
||||
LobbySongUpdated?.Invoke();
|
||||
}
|
||||
|
||||
private void LateJoinStatus(TickerLateJoinStatusEvent message)
|
||||
{
|
||||
DisallowedLateJoin = message.Disallowed;
|
||||
@@ -97,7 +105,7 @@ namespace Content.Client.GameTicking.Managers
|
||||
RoundStartTimeSpan = message.RoundStartTimeSpan;
|
||||
IsGameStarted = message.IsRoundStarted;
|
||||
AreWeReady = message.YouAreReady;
|
||||
LobbySong = message.LobbySong;
|
||||
SetLobbySong(message.LobbySong);
|
||||
LobbyBackground = message.LobbyBackground;
|
||||
Paused = message.Paused;
|
||||
|
||||
@@ -124,12 +132,8 @@ namespace Content.Client.GameTicking.Managers
|
||||
|
||||
private void RoundEnd(RoundEndMessageEvent message)
|
||||
{
|
||||
if (message.LobbySong != null)
|
||||
{
|
||||
LobbySong = message.LobbySong;
|
||||
_backgroundAudio.StartLobbyMusic();
|
||||
}
|
||||
|
||||
// Force an update in the event of this song being the same as the last.
|
||||
SetLobbySong(message.LobbySong, true);
|
||||
RestartSound = message.RestartSound;
|
||||
|
||||
// Don't open duplicate windows (mainly for replays).
|
||||
|
||||
Reference in New Issue
Block a user