diff --git a/Content.Client/Gameplay/GameplayState.cs b/Content.Client/Gameplay/GameplayState.cs index ca102e32ae..47cbc22e3e 100644 --- a/Content.Client/Gameplay/GameplayState.cs +++ b/Content.Client/Gameplay/GameplayState.cs @@ -106,6 +106,8 @@ namespace Content.Client.Gameplay { _chatController.SetMainChat(false); _menuController.UnloadButtons(); + _ghostController.UnloadGui(); + _actionController.UnloadGui(); _uiManager.UnloadScreen(); } @@ -132,8 +134,8 @@ namespace Content.Client.Gameplay _menuController.LoadButtons(); // TODO: This could just be like, the equivalent of an event or something - _ghostController.UpdateGui(); - _actionController.RegisterActionContainer(); + _ghostController.LoadGui(); + _actionController.LoadGui(); _alertsController.SyncAlerts(); _hotbarController.ReloadHotbar(); diff --git a/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs b/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs index 096fd0bcd2..1685086be8 100644 --- a/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs +++ b/Content.Client/UserInterface/Systems/Actions/ActionUIController.cs @@ -51,7 +51,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged UIManager.GetActiveUIWidgetOrNull(); private MenuButton? ActionButton => UIManager.GetActiveUIWidgetOrNull()?.ActionButton; private ActionPage CurrentPage => _pages[_currentPageIndex]; @@ -88,7 +88,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged(); - _actionsBar = UIManager.GetActiveUIWidget(); LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterTop); _window.OnOpen += OnWindowOpened; @@ -96,8 +95,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged(); } @@ -231,7 +223,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged(); - if (widget == null) - { - return; - } - _actionsSystem?.UnlinkAllActions(); - RegisterActionContainer(widget.ActionsContainer); + if (ActionsBar == null) + { + return; + } + + ActionsBar.PageButtons.LeftArrow.OnPressed -= OnLeftArrowPressed; + ActionsBar.PageButtons.RightArrow.OnPressed -= OnRightArrowPressed; + } + + public void LoadGui() + { + if (ActionsBar == null) + { + return; + } + + ActionsBar.PageButtons.LeftArrow.OnPressed += OnLeftArrowPressed; + ActionsBar.PageButtons.RightArrow.OnPressed += OnRightArrowPressed; + + + RegisterActionContainer(ActionsBar.ActionsContainer); _actionsSystem?.LinkAllActions(); } diff --git a/Content.Client/UserInterface/Systems/EscapeMenu/EscapeUIController.cs b/Content.Client/UserInterface/Systems/EscapeMenu/EscapeUIController.cs index 5f4232dc32..4af5c04216 100644 --- a/Content.Client/UserInterface/Systems/EscapeMenu/EscapeUIController.cs +++ b/Content.Client/UserInterface/Systems/EscapeMenu/EscapeUIController.cs @@ -36,15 +36,7 @@ public sealed class EscapeUIController : UIController, IOnStateEntered EscapeButton!.Pressed = true; @@ -74,6 +58,9 @@ public sealed class EscapeUIController : UIController, IOnStateEntered(); + _escapeWindow.OnClose += DeactivateButton; + _escapeWindow.OnOpen += ActivateButton; + _escapeWindow.ChangelogButton.OnPressed += _ => { CloseEscapeWindow(); @@ -144,6 +131,7 @@ public sealed class EscapeUIController : UIController, IOnStateEntered, IOnSystemChanged +public sealed class GhostUIController : UIController, IOnSystemChanged { [Dependency] private readonly IEntityNetworkManager _net = default!; @@ -91,7 +91,7 @@ public sealed class GhostUIController : UIController, IOnStateChanged