Cleaner BoundUserInterfaces (#17736)
This commit is contained in:
@@ -2,12 +2,13 @@ using Content.Client.Computer;
|
||||
using Content.Client.Shuttles.UI;
|
||||
using Content.Shared.Shuttles.BUIStates;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
|
||||
namespace Content.Client.Shuttles.BUI;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class EmergencyConsoleBoundUserInterface : ComputerBoundUserInterface<EmergencyConsoleWindow, EmergencyConsoleBoundUserInterfaceState>
|
||||
{
|
||||
public EmergencyConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
||||
public EmergencyConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,17 @@ namespace Content.Client.Shuttles.BUI;
|
||||
[UsedImplicitly]
|
||||
public sealed class IFFConsoleBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private IFFConsoleWindow? _window;
|
||||
|
||||
public IFFConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey)
|
||||
public IFFConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new IFFConsoleWindow();
|
||||
_window.OnClose += Close;
|
||||
_window.ShowIFF += SendIFFMessage;
|
||||
|
||||
@@ -8,13 +8,17 @@ namespace Content.Client.Shuttles.BUI;
|
||||
[UsedImplicitly]
|
||||
public sealed class RadarConsoleBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private RadarConsoleWindow? _window;
|
||||
|
||||
public RadarConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
||||
public RadarConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
_window = new RadarConsoleWindow();
|
||||
_window.OnClose += Close;
|
||||
_window.OpenCentered();
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using Content.Client.Shuttles.UI;
|
||||
using Content.Shared.Shuttles.BUIStates;
|
||||
using Content.Shared.Shuttles.Components;
|
||||
using Content.Shared.Shuttles.Events;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.GameObjects;
|
||||
@@ -10,9 +9,12 @@ namespace Content.Client.Shuttles.BUI;
|
||||
[UsedImplicitly]
|
||||
public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private ShuttleConsoleWindow? _window;
|
||||
|
||||
public ShuttleConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) {}
|
||||
public ShuttleConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
@@ -51,17 +53,17 @@ public sealed class ShuttleConsoleBoundUserInterface : BoundUserInterface
|
||||
|
||||
private void OnStopAutodockPressed(EntityUid obj)
|
||||
{
|
||||
SendMessage(new StopAutodockRequestMessage() {DockEntity = obj});
|
||||
SendMessage(new StopAutodockRequestMessage() { DockEntity = obj });
|
||||
}
|
||||
|
||||
private void OnAutodockPressed(EntityUid obj)
|
||||
{
|
||||
SendMessage(new AutodockRequestMessage() {DockEntity = obj});
|
||||
SendMessage(new AutodockRequestMessage() { DockEntity = obj });
|
||||
}
|
||||
|
||||
private void OnUndockPressed(EntityUid obj)
|
||||
{
|
||||
SendMessage(new UndockRequestMessage() {DockEntity = obj});
|
||||
SendMessage(new UndockRequestMessage() { DockEntity = obj });
|
||||
}
|
||||
|
||||
protected override void UpdateState(BoundUserInterfaceState state)
|
||||
|
||||
@@ -52,13 +52,13 @@ namespace Content.Client.Shuttles.Systems
|
||||
return;
|
||||
}
|
||||
|
||||
if (!TryComp<ShuttleConsoleComponent>(console, out var shuttleConsoleComponent))
|
||||
if (!HasComp<ShuttleConsoleComponent>(console))
|
||||
{
|
||||
Logger.Warning($"Unable to set Helmsman console to {console}");
|
||||
Log.Warning($"Unable to set Helmsman console to {console}");
|
||||
return;
|
||||
}
|
||||
|
||||
component.Console = shuttleConsoleComponent;
|
||||
component.Console = console;
|
||||
ActionBlockerSystem.UpdateCanMove(uid);
|
||||
_input.Contexts.SetActiveContext("shuttle");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user