From c828c53b9107263a873ba32abe315995be73e20c Mon Sep 17 00:00:00 2001 From: Flipp Syder <76629141+vulppine@users.noreply.github.com> Date: Mon, 17 Oct 2022 18:01:28 -0700 Subject: [PATCH] Oldchat fixes (#12009) * various fixes * whoops * oops * oop * removes that call from escape button on unload instead of adding another one also just moves escape window stuff into the state entered call, as only one is instantiated whenever the state is loaded (and is not dependent on the current screen) --- Content.Client/Gameplay/GameplayState.cs | 6 ++- .../Systems/Actions/ActionUIController.cs | 52 ++++++++++--------- .../Systems/EscapeMenu/EscapeUIController.cs | 22 ++------ .../Systems/Ghost/GhostUIController.cs | 6 +-- 4 files changed, 39 insertions(+), 47 deletions(-) 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