From e18f731b9122bf97565c2b3c177772986badfdc9 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Fri, 8 Sep 2023 23:52:36 +0200 Subject: [PATCH] Fix race condition causing some people being unable to connect. (#19920) --- Content.Client/Lobby/LobbyState.cs | 11 +++++++++++ Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs | 3 --- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Content.Client/Lobby/LobbyState.cs b/Content.Client/Lobby/LobbyState.cs index a77136ae41..457163a5b5 100644 --- a/Content.Client/Lobby/LobbyState.cs +++ b/Content.Client/Lobby/LobbyState.cs @@ -80,6 +80,10 @@ namespace Content.Client.Lobby _gameTicker.InfoBlobUpdated += UpdateLobbyUi; _gameTicker.LobbyStatusUpdated += LobbyStatusUpdated; _gameTicker.LobbyLateJoinStatusUpdated += LobbyLateJoinStatusUpdated; + + _preferencesManager.OnServerDataLoaded += PreferencesDataLoaded; + + _lobby.CharacterPreview.UpdateUI(); } protected override void Shutdown() @@ -100,6 +104,13 @@ namespace Content.Client.Lobby _characterSetup?.Dispose(); _characterSetup = null; + + _preferencesManager.OnServerDataLoaded -= PreferencesDataLoaded; + } + + private void PreferencesDataLoaded() + { + _lobby?.CharacterPreview.UpdateUI(); } private void OnSetupPressed(BaseButton.ButtonEventArgs args) diff --git a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs index a319c1a4f1..c63aee7edf 100644 --- a/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs +++ b/Content.Client/Lobby/UI/LobbyCharacterPreviewPanel.cs @@ -76,8 +76,6 @@ namespace Content.Client.Lobby.UI AddChild(vBox); UpdateUI(); - - _preferencesManager.OnServerDataLoaded += UpdateUI; } public Button CharacterSetupButton { get; } @@ -85,7 +83,6 @@ namespace Content.Client.Lobby.UI protected override void Dispose(bool disposing) { base.Dispose(disposing); - _preferencesManager.OnServerDataLoaded -= UpdateUI; if (!disposing) return; if (_previewDummy != null) _entityManager.DeleteEntity(_previewDummy.Value); -- 2.51.2