From 9315a0fe81705a66efb582de4aeb8f483a1e6afc Mon Sep 17 00:00:00 2001 From: DrSmugleaf Date: Mon, 14 Aug 2023 14:03:35 -0700 Subject: [PATCH] Fix having to reopen ahelp and popped-out ahelp windows after rounds (#19102) --- .../Systems/Bwoink/AHelpUIController.cs | 26 ++++++------------- 1 file changed, 8 insertions(+), 18 deletions(-) diff --git a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs index a13629df00..285b84ab19 100644 --- a/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs +++ b/Content.Client/UserInterface/Systems/Bwoink/AHelpUIController.cs @@ -4,7 +4,6 @@ using System.Numerics; using Content.Client.Administration.Managers; using Content.Client.Administration.Systems; using Content.Client.Administration.UI.Bwoink; -using Content.Client.Gameplay; using Content.Client.UserInterface.Controls; using Content.Shared.Administration; using Content.Shared.Input; @@ -24,7 +23,7 @@ using Robust.Shared.Utility; namespace Content.Client.UserInterface.Systems.Bwoink; [UsedImplicitly] -public sealed class AHelpUIController: UIController, IOnStateChanged, IOnSystemChanged +public sealed class AHelpUIController: UIController, IOnSystemChanged { [Dependency] private readonly IClientAdminManager _adminManager = default!; [Dependency] private readonly IPlayerManager _playerManager = default!; @@ -42,16 +41,8 @@ public sealed class AHelpUIController: UIController, IOnStateChanged(DiscordRelayUpdated); SubscribeNetworkEvent(PeopleTypingUpdated); - } - public void OnStateEntered(GameplayState state) - { _adminManager.AdminStatusUpdated += OnAdminStatusUpdated; - - CommandBinds.Builder - .Bind(ContentKeyFunctions.OpenAHelp, - InputCmdHandler.FromDelegate(_ => ToggleWindow())) - .Register(); } public void UnloadButton() @@ -87,22 +78,21 @@ public sealed class AHelpUIController: UIController, IOnStateChanged(); - } public void OnSystemLoaded(BwoinkSystem system) { _bwoinkSystem = system; _bwoinkSystem.OnBwoinkTextMessageRecieved += RecievedBwoink; + + CommandBinds.Builder + .Bind(ContentKeyFunctions.OpenAHelp, + InputCmdHandler.FromDelegate(_ => ToggleWindow())) + .Register(); } public void OnSystemUnloaded(BwoinkSystem system) { + CommandBinds.Unregister(); + DebugTools.Assert(_bwoinkSystem != null); _bwoinkSystem!.OnBwoinkTextMessageRecieved -= RecievedBwoink; _bwoinkSystem = null;