Evac shuttle (#8931)
Co-authored-by: metalgearsloth <metalgearsloth@gmail.com>
This commit is contained in:
41
Content.Client/Shuttles/UI/EmergencyConsoleWindow.xaml
Normal file
41
Content.Client/Shuttles/UI/EmergencyConsoleWindow.xaml
Normal file
@@ -0,0 +1,41 @@
|
||||
<userInterface:FancyWindow xmlns="https://spacestation14.io"
|
||||
xmlns:userInterface="clr-namespace:Content.Client.UserInterface"
|
||||
Title="Emergency Shuttle Console"
|
||||
MinSize="400 400">
|
||||
<BoxContainer Orientation="Vertical"
|
||||
Margin="5">
|
||||
<Label Name="Countdown"
|
||||
HorizontalAlignment="Center"
|
||||
Text="00:00"/>
|
||||
<BoxContainer Name="EngineStatusContainer"
|
||||
HorizontalAlignment="Center">
|
||||
<Label HorizontalAlignment="Center"
|
||||
Text="{Loc 'emergency-shuttle-ui-engines'}"/>
|
||||
<Label Name="EngineStatus"
|
||||
HorizontalAlignment="Center"
|
||||
FontColorOverride="#FFA500"
|
||||
Text="{Loc 'emergency-shuttle-ui-idle'}"/>
|
||||
</BoxContainer>
|
||||
<BoxContainer Name="LaunchContainer">
|
||||
<Label Text="{Loc 'emergency-shuttle-ui-early-authorize'}"/>
|
||||
<Button Name="RepealAllButton" Text="{Loc 'emergency-shuttle-ui-repeal-all'}"/>
|
||||
</BoxContainer>
|
||||
<!-- Spacer -->
|
||||
<BoxContainer Name="AuthorizeContainer">
|
||||
<Button Name="AuthorizeButton"
|
||||
Text="{Loc 'emergency-shuttle-ui-authorize'}"/>
|
||||
<Button Name="RepealButton" Text="{Loc 'emergency-shuttle-ui-repeal'}"/>
|
||||
</BoxContainer>
|
||||
<BoxContainer Name="AuthorizationsTextContainer">
|
||||
<Label Text="{Loc 'emergency-shuttle-ui-authorizations'}"/>
|
||||
<Label Name="AuthorizationCount"
|
||||
Text="{Loc 'emergency-shuttle-ui-remaining'}"
|
||||
HorizontalAlignment="Right"
|
||||
Align="Right"
|
||||
HorizontalExpand="True"/>
|
||||
</BoxContainer>
|
||||
<!-- Spacer -->
|
||||
<BoxContainer Name="AuthorizationsContainer" Orientation="Vertical">
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
</userInterface:FancyWindow>
|
||||
93
Content.Client/Shuttles/UI/EmergencyConsoleWindow.xaml.cs
Normal file
93
Content.Client/Shuttles/UI/EmergencyConsoleWindow.xaml.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using Content.Client.Computer;
|
||||
using Content.Client.UserInterface;
|
||||
using Content.Shared.Shuttles.BUIStates;
|
||||
using Content.Shared.Shuttles.Events;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client.Shuttles.UI;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class EmergencyConsoleWindow : FancyWindow,
|
||||
IComputerWindow<EmergencyConsoleBoundUserInterfaceState>
|
||||
{
|
||||
private readonly IGameTiming _timing;
|
||||
private TimeSpan? _earlyLaunchTime;
|
||||
|
||||
public EmergencyConsoleWindow()
|
||||
{
|
||||
_timing = IoCManager.Resolve<IGameTiming>();
|
||||
RobustXamlLoader.Load(this);
|
||||
}
|
||||
|
||||
public void SetupComputerWindow(ComputerBoundUserInterfaceBase cb)
|
||||
{
|
||||
RepealAllButton.OnPressed += args =>
|
||||
{
|
||||
OnRepealAllPressed(cb, args);
|
||||
};
|
||||
AuthorizeButton.OnPressed += args =>
|
||||
{
|
||||
OnAuthorizePressed(cb, args);
|
||||
};
|
||||
RepealButton.OnPressed += args =>
|
||||
{
|
||||
OnRepealPressed(cb, args);
|
||||
};
|
||||
}
|
||||
|
||||
private void OnRepealAllPressed(ComputerBoundUserInterfaceBase cb, BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
cb.SendMessage(new EmergencyShuttleRepealAllMessage());
|
||||
}
|
||||
|
||||
private void OnRepealPressed(ComputerBoundUserInterfaceBase cb, BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
cb.SendMessage(new EmergencyShuttleRepealMessage());
|
||||
}
|
||||
|
||||
private void OnAuthorizePressed(ComputerBoundUserInterfaceBase cb, BaseButton.ButtonEventArgs obj)
|
||||
{
|
||||
cb.SendMessage(new EmergencyShuttleAuthorizeMessage());
|
||||
}
|
||||
|
||||
public void UpdateState(EmergencyConsoleBoundUserInterfaceState scc)
|
||||
{
|
||||
// TODO: Loc and cvar for this.
|
||||
_earlyLaunchTime = scc.EarlyLaunchTime;
|
||||
|
||||
AuthorizationsContainer.DisposeAllChildren();
|
||||
var remainingAuths = scc.AuthorizationsRequired - scc.Authorizations.Count;
|
||||
AuthorizationCount.Text = Loc.GetString("emergency-shuttle-ui-remaining", ("remaining", remainingAuths));
|
||||
|
||||
foreach (var auth in scc.Authorizations)
|
||||
{
|
||||
AuthorizationsContainer.AddChild(new Label
|
||||
{
|
||||
Text = auth,
|
||||
FontColorOverride = Color.Lime,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Draw(DrawingHandleScreen handle)
|
||||
{
|
||||
base.Draw(handle);
|
||||
if (_earlyLaunchTime == null)
|
||||
{
|
||||
Countdown.Text = "00:10";
|
||||
}
|
||||
else
|
||||
{
|
||||
var remaining = _earlyLaunchTime.Value - _timing.CurTime;
|
||||
|
||||
if (remaining < TimeSpan.Zero)
|
||||
remaining = TimeSpan.Zero;
|
||||
|
||||
Countdown.Text = $"{remaining.Minutes:00}:{remaining.Seconds:00}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public sealed class RadarControl : Control
|
||||
/// </summary>
|
||||
private Dictionary<EntityUid, Control> _iffControls = new();
|
||||
|
||||
private Dictionary<EntityUid, Dictionary<EntityUid, DockingInterfaceState>> _docks = new();
|
||||
private Dictionary<EntityUid, List<DockingInterfaceState>> _docks = new();
|
||||
|
||||
public bool ShowIFF { get; set; } = true;
|
||||
public bool ShowDocks { get; set; } = true;
|
||||
@@ -88,7 +88,7 @@ public sealed class RadarControl : Control
|
||||
{
|
||||
var coordinates = state.Coordinates;
|
||||
var grid = _docks.GetOrNew(coordinates.EntityId);
|
||||
grid.Add(state.Entity, state);
|
||||
grid.Add(state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,8 +288,9 @@ public sealed class RadarControl : Control
|
||||
|
||||
if (_docks.TryGetValue(uid, out var docks))
|
||||
{
|
||||
foreach (var (ent, state) in docks)
|
||||
foreach (var state in docks)
|
||||
{
|
||||
var ent = state.Entity;
|
||||
var position = state.Coordinates.Position;
|
||||
var uiPosition = matrix.Transform(position);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user