mirror of
https://github.com/wega-team/ss14-wega.git
synced 2026-02-14 19:30:01 +01:00
upmanifest
This commit is contained in:
@@ -1,19 +1,29 @@
|
||||
<!-- Corvax-Wega-Edit -->
|
||||
<DefaultWindow xmlns="https://spacestation14.io"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
xmlns:ui="clr-namespace:Content.Client.CrewManifest.UI"
|
||||
Title="{Loc 'crew-manifest-window-title'}"
|
||||
SetSize="500 800">
|
||||
SetSize="600 800">
|
||||
<BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True">
|
||||
<controls:StripeBack Name="StationNameContainer">
|
||||
<PanelContainer>
|
||||
<Label Name="StationName" Align="Center" />
|
||||
<Label Name="StationName" Align="Center"
|
||||
Margin="4" StyleClasses="LabelBig" />
|
||||
</PanelContainer>
|
||||
</controls:StripeBack>
|
||||
<BoxContainer HorizontalExpand="True" VerticalExpand="True">
|
||||
<ScrollContainer HorizontalExpand="True" VerticalExpand="True">
|
||||
<!-- this MIGHT have race conditions -->
|
||||
<ui:CrewManifestListing Name="CrewManifestListing" Orientation="Vertical" HorizontalExpand="True">
|
||||
<Label Text="{Loc 'crew-manifest-no-valid-station'}" HorizontalExpand="True" />
|
||||
<ui:CrewManifestListing Name="CrewManifestListing"
|
||||
Orientation="Vertical"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
Margin="4">
|
||||
<Label Text="{Loc 'crew-manifest-no-valid-station'}"
|
||||
HorizontalExpand="True"
|
||||
VerticalExpand="True"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</ui:CrewManifestListing>
|
||||
<!-- Crew manifest goes here. -->
|
||||
</ScrollContainer>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
using Content.Shared.CrewManifest;
|
||||
using System.Linq; // Corvax-Wega-Add
|
||||
using System.Numerics; // Corvax-Wega-Add
|
||||
using Content.Shared.CrewManifest;
|
||||
using Content.Shared.Roles;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.UserInterface; // Corvax-Wega-Add
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
@@ -17,10 +20,33 @@ public sealed class CrewManifestListing : BoxContainer
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
_spriteSystem = _entitySystem.GetEntitySystem<SpriteSystem>();
|
||||
// Corvax-Wega-Add-start
|
||||
Orientation = LayoutOrientation.Vertical;
|
||||
HorizontalExpand = true;
|
||||
VerticalExpand = true;
|
||||
SeparationOverride = 4;
|
||||
// Corvax-Wega-Add-end
|
||||
}
|
||||
|
||||
public void AddCrewManifestEntries(CrewManifestEntries entries)
|
||||
{
|
||||
// Corvax-Wega-Add-start
|
||||
RemoveAllChildren();
|
||||
|
||||
if (entries == null || entries.Entries.Count() == 0)
|
||||
{
|
||||
AddChild(new Label
|
||||
{
|
||||
Text = Loc.GetString("crew-manifest-no-entries"),
|
||||
HorizontalAlignment = HAlignment.Center,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
HorizontalExpand = true,
|
||||
VerticalExpand = true
|
||||
});
|
||||
return;
|
||||
}
|
||||
// Corvax-Wega-Add-end
|
||||
|
||||
var entryDict = new Dictionary<DepartmentPrototype, List<CrewManifestEntry>>();
|
||||
|
||||
foreach (var entry in entries.Entries)
|
||||
@@ -44,9 +70,19 @@ public sealed class CrewManifestListing : BoxContainer
|
||||
|
||||
entryList.Sort((a, b) => DepartmentUIComparer.Instance.Compare(a.section, b.section));
|
||||
|
||||
// Corvax-Wega-Edit-start
|
||||
foreach (var item in entryList)
|
||||
{
|
||||
AddChild(new CrewManifestSection(_prototypeManager, _spriteSystem, item.section, item.entries));
|
||||
var section = new CrewManifestSection(_prototypeManager, _spriteSystem, item.section, item.entries);
|
||||
section.Margin = new Thickness(0, 0, 0, 8);
|
||||
AddChild(section);
|
||||
}
|
||||
|
||||
if (entryList.Count > 0)
|
||||
{
|
||||
AddChild(new Control { MinSize = new Vector2(0, 4) });
|
||||
}
|
||||
// Corvax-Wega-Edit-start
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using Content.Shared.CrewManifest;
|
||||
using Content.Shared.StatusIcon;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics; // Corvax-Wega-Add
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility; // Corvax-Wega-Add
|
||||
using System.Numerics;
|
||||
using Content.Shared.Roles;
|
||||
|
||||
@@ -19,58 +21,131 @@ public sealed class CrewManifestSection : BoxContainer
|
||||
Orientation = LayoutOrientation.Vertical;
|
||||
HorizontalExpand = true;
|
||||
|
||||
AddChild(new Label()
|
||||
// Corvax-Wega-Edit-start
|
||||
AddChild(new PanelContainer
|
||||
{
|
||||
StyleClasses = { "LabelBig" },
|
||||
Text = Loc.GetString(section.Name)
|
||||
PanelOverride = new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = Color.FromHex("#2D2D33"),
|
||||
ContentMarginBottomOverride = 2,
|
||||
ContentMarginLeftOverride = 4,
|
||||
ContentMarginRightOverride = 4,
|
||||
ContentMarginTopOverride = 2
|
||||
},
|
||||
Children =
|
||||
{
|
||||
new Label()
|
||||
{
|
||||
StyleClasses = { "LabelBig" },
|
||||
Text = Loc.GetString(section.Name),
|
||||
Margin = new Thickness(4, 2)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var gridContainer = new GridContainer()
|
||||
var departmentContainer = new BoxContainer
|
||||
{
|
||||
Orientation = LayoutOrientation.Vertical,
|
||||
HorizontalExpand = true,
|
||||
Columns = 2
|
||||
Margin = new Thickness(0, 4, 0, 8)
|
||||
};
|
||||
|
||||
AddChild(gridContainer);
|
||||
AddChild(departmentContainer);
|
||||
|
||||
var rowCount = 0;
|
||||
foreach (var entry in entries)
|
||||
{
|
||||
var rowColor1 = Color.FromHex("#1B1B1E");
|
||||
var rowColor2 = Color.FromHex("#202025");
|
||||
var currentRowColor = (rowCount % 2 == 0) ? rowColor1 : rowColor2;
|
||||
rowCount++;
|
||||
|
||||
var rowPanel = new PanelContainer
|
||||
{
|
||||
HorizontalExpand = true,
|
||||
PanelOverride = new StyleBoxFlat
|
||||
{
|
||||
BackgroundColor = currentRowColor,
|
||||
ContentMarginBottomOverride = 4,
|
||||
ContentMarginLeftOverride = 8,
|
||||
ContentMarginRightOverride = 8,
|
||||
ContentMarginTopOverride = 4
|
||||
}
|
||||
};
|
||||
|
||||
var rowContainer = new BoxContainer
|
||||
{
|
||||
Orientation = LayoutOrientation.Horizontal,
|
||||
HorizontalExpand = true,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
SeparationOverride = 8
|
||||
};
|
||||
|
||||
var nameContainer = new BoxContainer
|
||||
{
|
||||
Orientation = LayoutOrientation.Vertical,
|
||||
HorizontalExpand = true,
|
||||
VerticalExpand = true
|
||||
};
|
||||
|
||||
var name = new RichTextLabel()
|
||||
{
|
||||
HorizontalExpand = true,
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
Margin = new Thickness(4, 0)
|
||||
};
|
||||
name.SetMessage(entry.Name);
|
||||
nameContainer.AddChild(name);
|
||||
|
||||
var titleContainer = new BoxContainer()
|
||||
{
|
||||
Orientation = LayoutOrientation.Horizontal,
|
||||
HorizontalExpand = true
|
||||
HorizontalExpand = true,
|
||||
VerticalAlignment = VAlignment.Center
|
||||
};
|
||||
|
||||
var title = new RichTextLabel();
|
||||
var title = new RichTextLabel()
|
||||
{
|
||||
VerticalAlignment = VAlignment.Center
|
||||
};
|
||||
title.SetMessage(entry.JobTitle);
|
||||
|
||||
SpriteSpecifier? iconSpecifier = null;
|
||||
if (prototypeManager.HasIndex<JobIconPrototype>(entry.JobIcon))
|
||||
{
|
||||
var jobIcon = prototypeManager.Index<JobIconPrototype>(entry.JobIcon);
|
||||
iconSpecifier = jobIcon.Icon;
|
||||
}
|
||||
else if (prototypeManager.HasIndex<StatusIconPrototype>(entry.JobIcon))
|
||||
{
|
||||
var statusIcon = prototypeManager.Index<StatusIconPrototype>(entry.JobIcon);
|
||||
iconSpecifier = statusIcon.Icon;
|
||||
}
|
||||
|
||||
if (prototypeManager.TryIndex<JobIconPrototype>(entry.JobIcon, out var jobIcon))
|
||||
if (iconSpecifier != null)
|
||||
{
|
||||
var icon = new TextureRect()
|
||||
{
|
||||
TextureScale = new Vector2(2, 2),
|
||||
VerticalAlignment = VAlignment.Center,
|
||||
Texture = spriteSystem.Frame0(jobIcon.Icon),
|
||||
Margin = new Thickness(0, 0, 4, 0)
|
||||
HorizontalAlignment = HAlignment.Left,
|
||||
Texture = spriteSystem.Frame0(iconSpecifier),
|
||||
Margin = new Thickness(0, 0, 4, 0),
|
||||
Stretch = TextureRect.StretchMode.KeepCentered
|
||||
};
|
||||
|
||||
titleContainer.AddChild(icon);
|
||||
titleContainer.AddChild(title);
|
||||
}
|
||||
else
|
||||
{
|
||||
titleContainer.AddChild(title);
|
||||
}
|
||||
|
||||
gridContainer.AddChild(name);
|
||||
gridContainer.AddChild(titleContainer);
|
||||
titleContainer.AddChild(title);
|
||||
|
||||
rowContainer.AddChild(nameContainer);
|
||||
rowContainer.AddChild(titleContainer);
|
||||
|
||||
rowPanel.AddChild(rowContainer);
|
||||
|
||||
departmentContainer.AddChild(rowPanel);
|
||||
// Corvax-Wega-Edit-end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
crew-manifest-no-entries = Нет записей в манифесте
|
||||
Reference in New Issue
Block a user