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)
This commit is contained in:
@@ -106,6 +106,8 @@ namespace Content.Client.Gameplay
|
|||||||
{
|
{
|
||||||
_chatController.SetMainChat(false);
|
_chatController.SetMainChat(false);
|
||||||
_menuController.UnloadButtons();
|
_menuController.UnloadButtons();
|
||||||
|
_ghostController.UnloadGui();
|
||||||
|
_actionController.UnloadGui();
|
||||||
_uiManager.UnloadScreen();
|
_uiManager.UnloadScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,8 +134,8 @@ namespace Content.Client.Gameplay
|
|||||||
_menuController.LoadButtons();
|
_menuController.LoadButtons();
|
||||||
|
|
||||||
// TODO: This could just be like, the equivalent of an event or something
|
// TODO: This could just be like, the equivalent of an event or something
|
||||||
_ghostController.UpdateGui();
|
_ghostController.LoadGui();
|
||||||
_actionController.RegisterActionContainer();
|
_actionController.LoadGui();
|
||||||
_alertsController.SyncAlerts();
|
_alertsController.SyncAlerts();
|
||||||
_hotbarController.ReloadHotbar();
|
_hotbarController.ReloadHotbar();
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
|||||||
private readonly TextureRect _dragShadow;
|
private readonly TextureRect _dragShadow;
|
||||||
private ActionsWindow? _window;
|
private ActionsWindow? _window;
|
||||||
|
|
||||||
private ActionsBar? _actionsBar;
|
private ActionsBar? ActionsBar => UIManager.GetActiveUIWidgetOrNull<ActionsBar>();
|
||||||
private MenuButton? ActionButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.ActionButton;
|
private MenuButton? ActionButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.ActionButton;
|
||||||
private ActionPage CurrentPage => _pages[_currentPageIndex];
|
private ActionPage CurrentPage => _pages[_currentPageIndex];
|
||||||
|
|
||||||
@@ -88,7 +88,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
|||||||
DebugTools.Assert(_window == null);
|
DebugTools.Assert(_window == null);
|
||||||
|
|
||||||
_window = UIManager.CreateWindow<ActionsWindow>();
|
_window = UIManager.CreateWindow<ActionsWindow>();
|
||||||
_actionsBar = UIManager.GetActiveUIWidget<ActionsBar>();
|
|
||||||
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterTop);
|
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterTop);
|
||||||
|
|
||||||
_window.OnOpen += OnWindowOpened;
|
_window.OnOpen += OnWindowOpened;
|
||||||
@@ -96,8 +95,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
|||||||
_window.ClearButton.OnPressed += OnClearPressed;
|
_window.ClearButton.OnPressed += OnClearPressed;
|
||||||
_window.SearchBar.OnTextChanged += OnSearchChanged;
|
_window.SearchBar.OnTextChanged += OnSearchChanged;
|
||||||
_window.FilterButton.OnItemSelected += OnFilterSelected;
|
_window.FilterButton.OnItemSelected += OnFilterSelected;
|
||||||
_actionsBar.PageButtons.LeftArrow.OnPressed += OnLeftArrowPressed;
|
|
||||||
_actionsBar.PageButtons.RightArrow.OnPressed += OnRightArrowPressed;
|
|
||||||
|
|
||||||
if (_actionsSystem != null)
|
if (_actionsSystem != null)
|
||||||
{
|
{
|
||||||
@@ -198,12 +196,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
|||||||
_window = null;
|
_window = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_actionsBar != null)
|
|
||||||
{
|
|
||||||
_actionsBar.PageButtons.LeftArrow.OnPressed += OnLeftArrowPressed;
|
|
||||||
_actionsBar.PageButtons.RightArrow.OnPressed += OnRightArrowPressed;
|
|
||||||
}
|
|
||||||
|
|
||||||
CommandBinds.Unregister<ActionUIController>();
|
CommandBinds.Unregister<ActionUIController>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -231,7 +223,7 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
|||||||
var page = _pages[_currentPageIndex];
|
var page = _pages[_currentPageIndex];
|
||||||
_container?.SetActionData(page);
|
_container?.SetActionData(page);
|
||||||
|
|
||||||
_actionsBar!.PageButtons.Label.Text = $"{_currentPageIndex + 1}";
|
ActionsBar!.PageButtons.Label.Text = $"{_currentPageIndex + 1}";
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnLeftArrowPressed(ButtonEventArgs args)
|
private void OnLeftArrowPressed(ButtonEventArgs args)
|
||||||
@@ -621,25 +613,35 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
|||||||
|
|
||||||
public void ReloadActionContainer()
|
public void ReloadActionContainer()
|
||||||
{
|
{
|
||||||
RegisterActionContainer();
|
UnloadGui();
|
||||||
|
LoadGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RegisterActionContainer()
|
public void UnloadGui()
|
||||||
{
|
{
|
||||||
if (UIManager.ActiveScreen == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var widget = UIManager.ActiveScreen.GetWidget<ActionsBar>();
|
|
||||||
if (widget == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_actionsSystem?.UnlinkAllActions();
|
_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();
|
_actionsSystem?.LinkAllActions();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,15 +36,7 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
|||||||
}
|
}
|
||||||
|
|
||||||
EscapeButton.Pressed = false;
|
EscapeButton.Pressed = false;
|
||||||
EscapeButton.OnPressed += EscapeButtonOnOnPressed;
|
EscapeButton.OnPressed -= EscapeButtonOnOnPressed;
|
||||||
|
|
||||||
if (_escapeWindow == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_escapeWindow.OnClose -= DeactivateButton;
|
|
||||||
_escapeWindow.OnOpen -= ActivateButton;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadButton()
|
public void LoadButton()
|
||||||
@@ -55,14 +47,6 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
|||||||
}
|
}
|
||||||
|
|
||||||
EscapeButton.OnPressed += EscapeButtonOnOnPressed;
|
EscapeButton.OnPressed += EscapeButtonOnOnPressed;
|
||||||
|
|
||||||
if (_escapeWindow == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_escapeWindow.OnClose += DeactivateButton;
|
|
||||||
_escapeWindow.OnOpen += ActivateButton;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ActivateButton() => EscapeButton!.Pressed = true;
|
private void ActivateButton() => EscapeButton!.Pressed = true;
|
||||||
@@ -74,6 +58,9 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
|||||||
|
|
||||||
_escapeWindow = UIManager.CreateWindow<Options.UI.EscapeMenu>();
|
_escapeWindow = UIManager.CreateWindow<Options.UI.EscapeMenu>();
|
||||||
|
|
||||||
|
_escapeWindow.OnClose += DeactivateButton;
|
||||||
|
_escapeWindow.OnOpen += ActivateButton;
|
||||||
|
|
||||||
_escapeWindow.ChangelogButton.OnPressed += _ =>
|
_escapeWindow.ChangelogButton.OnPressed += _ =>
|
||||||
{
|
{
|
||||||
CloseEscapeWindow();
|
CloseEscapeWindow();
|
||||||
@@ -144,6 +131,7 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
|||||||
if (_escapeWindow.IsOpen)
|
if (_escapeWindow.IsOpen)
|
||||||
{
|
{
|
||||||
CloseEscapeWindow();
|
CloseEscapeWindow();
|
||||||
|
EscapeButton!.Pressed = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ using Robust.Client.UserInterface.Controllers;
|
|||||||
namespace Content.Client.UserInterface.Systems.Ghost;
|
namespace Content.Client.UserInterface.Systems.Ghost;
|
||||||
|
|
||||||
// TODO hud refactor BEFORE MERGE fix ghost gui being too far up
|
// TODO hud refactor BEFORE MERGE fix ghost gui being too far up
|
||||||
public sealed class GhostUIController : UIController, IOnStateChanged<GameplayState>, IOnSystemChanged<GhostSystem>
|
public sealed class GhostUIController : UIController, IOnSystemChanged<GhostSystem>
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IEntityNetworkManager _net = default!;
|
[Dependency] private readonly IEntityNetworkManager _net = default!;
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ public sealed class GhostUIController : UIController, IOnStateChanged<GameplaySt
|
|||||||
_net.SendSystemNetworkMessage(msg);
|
_net.SendSystemNetworkMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnStateEntered(GameplayState state)
|
public void LoadGui()
|
||||||
{
|
{
|
||||||
if (Gui == null)
|
if (Gui == null)
|
||||||
return;
|
return;
|
||||||
@@ -104,7 +104,7 @@ public sealed class GhostUIController : UIController, IOnStateChanged<GameplaySt
|
|||||||
UpdateGui();
|
UpdateGui();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnStateExited(GameplayState state)
|
public void UnloadGui()
|
||||||
{
|
{
|
||||||
if (Gui == null)
|
if (Gui == null)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user