diff --git a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs index c3c121dc2a..8551e6582d 100644 --- a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs +++ b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs @@ -518,14 +518,14 @@ public sealed class UserAHelpUIHandler : IAHelpUIHandler public void ToggleWindow() { - EnsureInit(_discordRelayActive); - if (_window!.IsOpen) + var createdWindow = EnsureInit(_discordRelayActive); + if (!createdWindow && _window!.IsOpen) { _window.Close(); } else { - _window.OpenCentered(); + _window!.OpenCentered(); } } @@ -559,10 +559,14 @@ public sealed class UserAHelpUIHandler : IAHelpUIHandler _window!.OpenCentered(); } - private void EnsureInit(bool relayActive) + /// + /// Create new ahelp window or return existing window + /// + /// True if new window was created + private bool EnsureInit(bool relayActive) { if (_window is { Disposed: false }) - return; + return false; _chatPanel = new BwoinkPanel(text => SendMessageAction?.Invoke(_ownerId, text, true, false)); _chatPanel.InputTextChanged += text => InputTextChanged?.Invoke(_ownerId, text); _chatPanel.RelayedToDiscordLabel.Visible = relayActive; @@ -580,6 +584,7 @@ public sealed class UserAHelpUIHandler : IAHelpUIHandler var introText = Loc.GetString("bwoink-system-introductory-message"); var introMessage = new SharedBwoinkSystem.BwoinkTextMessage( _ownerId, SharedBwoinkSystem.SystemUserId, introText); Receive(introMessage); + return true; } public void Dispose()