Add panic bunker UI and automatic panic bunker (#20954)

This commit is contained in:
DrSmugleaf
2023-10-13 11:56:12 -07:00
committed by GitHub
parent e972ce7984
commit db4ad40430
20 changed files with 536 additions and 34 deletions

View File

@@ -2,11 +2,13 @@
using Content.Client.Administration.Systems;
using Content.Client.Administration.UI;
using Content.Client.Administration.UI.Tabs.ObjectsTab;
using Content.Client.Administration.UI.Tabs.PanicBunkerTab;
using Content.Client.Administration.UI.Tabs.PlayerTab;
using Content.Client.Gameplay;
using Content.Client.Lobby;
using Content.Client.UserInterface.Controls;
using Content.Client.Verbs.UI;
using Content.Shared.Administration.Events;
using Content.Shared.Input;
using JetBrains.Annotations;
using Robust.Client.Console;
@@ -30,6 +32,25 @@ public sealed class AdminUIController : UIController, IOnStateEntered<GameplaySt
private AdminMenuWindow? _window;
private MenuButton? AdminButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.AdminButton;
private PanicBunkerStatus? _panicBunker;
public override void Initialize()
{
base.Initialize();
SubscribeNetworkEvent<PanicBunkerChangedEvent>(OnPanicBunkerUpdated);
}
private void OnPanicBunkerUpdated(PanicBunkerChangedEvent msg, EntitySessionEventArgs args)
{
var showDialog = _panicBunker == null && msg.Status.Enabled;
_panicBunker = msg.Status;
_window?.PanicBunkerControl.UpdateStatus(msg.Status);
if (showDialog)
{
UIManager.CreateWindow<PanicBunkerStatusWindow>().OpenCentered();
}
}
public void OnStateEntered(GameplayState state)
{
@@ -73,6 +94,9 @@ public sealed class AdminUIController : UIController, IOnStateEntered<GameplaySt
_window = UIManager.CreateWindow<AdminMenuWindow>();
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.Center);
if (_panicBunker != null)
_window.PanicBunkerControl.UpdateStatus(_panicBunker);
_window.PlayerTabControl.OnEntryPressed += PlayerTabEntryPressed;
_window.ObjectsTabControl.OnEntryPressed += ObjectsTabEntryPressed;
_window.OnOpen += OnWindowOpen;