Crew manifest as a PDA cartridge program (#18498)
Co-authored-by: Phill101 <holypics4@gmail.com>
This commit is contained in:
29
Content.Client/CartridgeLoader/Cartridges/CrewManifestUi.cs
Normal file
29
Content.Client/CartridgeLoader/Cartridges/CrewManifestUi.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Content.Client.UserInterface.Fragments;
|
||||
using Content.Shared.CartridgeLoader.Cartridges;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface;
|
||||
|
||||
namespace Content.Client.CartridgeLoader.Cartridges;
|
||||
|
||||
public sealed class CrewManifestUi : UIFragment
|
||||
{
|
||||
private CrewManifestUiFragment? _fragment;
|
||||
|
||||
public override Control GetUIFragmentRoot()
|
||||
{
|
||||
return _fragment!;
|
||||
}
|
||||
|
||||
public override void Setup(BoundUserInterface userInterface, EntityUid? fragmentOwner)
|
||||
{
|
||||
_fragment = new CrewManifestUiFragment();
|
||||
}
|
||||
|
||||
public override void UpdateState(BoundUserInterfaceState state)
|
||||
{
|
||||
if (state is not CrewManifestUiState crewManifestState)
|
||||
return;
|
||||
|
||||
_fragment?.UpdateState(crewManifestState.StationName, crewManifestState.Entries);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<cartridges:CrewManifestUiFragment xmlns:cartridges="clr-namespace:Content.Client.CartridgeLoader.Cartridges"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
xmlns:ui="clr-namespace:Content.Client.CrewManifest.UI"
|
||||
xmlns="https://spacestation14.io" Margin="1 0 2 0">
|
||||
<PanelContainer StyleClasses="BackgroundDark"></PanelContainer>
|
||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True">
|
||||
<controls:StripeBack Name="StationNameContainer">
|
||||
<PanelContainer>
|
||||
<Label Name="StationName" Align="Center" Text="{Loc 'crew-manifest-cartridge-loading'}"/>
|
||||
</PanelContainer>
|
||||
</controls:StripeBack>
|
||||
<ScrollContainer HorizontalExpand="True" VerticalExpand="True">
|
||||
<ui:CrewManifestListing
|
||||
Name="CrewManifestListing"
|
||||
Orientation="Vertical"
|
||||
HorizontalExpand="True"
|
||||
Margin="8,0,0,0"/>
|
||||
</ScrollContainer>
|
||||
</BoxContainer>
|
||||
</cartridges:CrewManifestUiFragment>
|
||||
@@ -0,0 +1,34 @@
|
||||
using Content.Shared.CrewManifest;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
namespace Content.Client.CartridgeLoader.Cartridges;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class CrewManifestUiFragment : BoxContainer
|
||||
{
|
||||
public CrewManifestUiFragment()
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
StationName.AddStyleClass("LabelBig");
|
||||
Orientation = LayoutOrientation.Vertical;
|
||||
HorizontalExpand = true;
|
||||
VerticalExpand = true;
|
||||
}
|
||||
|
||||
public void UpdateState(string stationName, CrewManifestEntries? entries)
|
||||
{
|
||||
CrewManifestListing.DisposeAllChildren();
|
||||
CrewManifestListing.RemoveAllChildren();
|
||||
|
||||
StationNameContainer.Visible = entries != null;
|
||||
StationName.Text = stationName;
|
||||
|
||||
if (entries == null)
|
||||
return;
|
||||
|
||||
CrewManifestListing.AddCrewManifestEntries(entries);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user