Give nukies the ability to declare war for a TC boost (#19291)
Co-authored-by: Kevin Zheng <kevinz5000@gmail.com>
This commit is contained in:
49
Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs
Normal file
49
Content.Client/NukeOps/WarDeclaratorBoundUserInterface.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Content.Shared.NukeOps;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client.NukeOps;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class WarDeclaratorBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private WarDeclaratorWindow? _window;
|
||||
|
||||
public WarDeclaratorBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) {}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new WarDeclaratorWindow();
|
||||
if (State != null)
|
||||
UpdateState(State);
|
||||
|
||||
_window.OpenCentered();
|
||||
|
||||
_window.OnClose += Close;
|
||||
_window.OnActivated += OnWarDeclaratorActivated;
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
base.UpdateState(state);
|
||||
if (_window == null || state is not WarDeclaratorBoundUserInterfaceState cast)
|
||||
return;
|
||||
|
||||
_window?.UpdateState(cast);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if (disposing) _window?.Dispose();
|
||||
}
|
||||
|
||||
private void OnWarDeclaratorActivated(string message)
|
||||
{
|
||||
SendMessage(new WarDeclaratorActivateMessage(message));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user