From 29879a151f2e7600439a8bde0442bec30a03ddfc Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 8 Jan 2025 06:39:09 -0500 Subject: [PATCH] Add pronouns to crew manifest (#2647) * Refactored crew manifest * Add Delta-V Comments, Move locale file to _DV scope. * Missed adding comments to a file. * Made the comments slightly more verbose to make it clear why the changes were made. * Comments are love, comments are life. --------- Co-authored-by: TGRCDev --- .../CrewManifest/UI/CrewManifestSection.cs | 50 ++++++++++++++++--- Content.Client/Stylesheets/StyleNano.cs | 9 ++++ .../CrewManifest/CrewManifestSystem.cs | 3 +- .../CrewManifest/SharedCrewManifestSystem.cs | 5 +- Resources/Locale/en-US/_DV/gender.ftl | 6 +++ 5 files changed, 65 insertions(+), 8 deletions(-) create mode 100644 Resources/Locale/en-US/_DV/gender.ftl diff --git a/Content.Client/CrewManifest/UI/CrewManifestSection.cs b/Content.Client/CrewManifest/UI/CrewManifestSection.cs index 29cf850e2b9..61eca5704b9 100644 --- a/Content.Client/CrewManifest/UI/CrewManifestSection.cs +++ b/Content.Client/CrewManifest/UI/CrewManifestSection.cs @@ -25,26 +25,62 @@ public CrewManifestSection( Text = Loc.GetString($"department-{section.ID}") }); - var gridContainer = new GridContainer() + // Delta-V - changed type from GridContainer to BoxContainer to better handle long names and titles. + var gridContainer = new BoxContainer() { + Orientation = LayoutOrientation.Horizontal, HorizontalExpand = true, - Columns = 2 }; + // Delta-V - Start of column BoxContainers. + var namesContainer = new BoxContainer() + { + Orientation = LayoutOrientation.Vertical, + HorizontalExpand = true, + SizeFlagsStretchRatio = 3, + }; + + var titlesContainer = new BoxContainer() + { + Orientation = LayoutOrientation.Vertical, + HorizontalExpand = true, + SizeFlagsStretchRatio = 2, + }; + + gridContainer.AddChild(namesContainer); + gridContainer.AddChild(titlesContainer); + // Delta-V - end of column BoxContainers. + AddChild(gridContainer); foreach (var entry in entries) { - var name = new RichTextLabel() + // Delta-V - start of name and pronoun container + var nameContainer = new BoxContainer() { + Orientation = LayoutOrientation.Horizontal, HorizontalExpand = true, }; + + var name = new RichTextLabel(); name.SetMessage(entry.Name); + var gender = new RichTextLabel() + { + Margin = new Thickness(6, 0, 0, 0), + StyleClasses = { "CrewManifestGender" } + }; + gender.SetMessage(Loc.GetString("gender-display", ("gender", entry.Gender))); + + nameContainer.AddChild(name); + nameContainer.AddChild(gender); + // Delta-V - end of name and pronoun container + var titleContainer = new BoxContainer() { Orientation = LayoutOrientation.Horizontal, - HorizontalExpand = true + HorizontalExpand = true, + SizeFlagsStretchRatio = 1, // Delta-V }; var title = new RichTextLabel(); @@ -69,8 +105,10 @@ public CrewManifestSection( titleContainer.AddChild(title); } - gridContainer.AddChild(name); - gridContainer.AddChild(titleContainer); + // Delta-V - grid was replaced with two BoxContainer columns + namesContainer.AddChild(nameContainer); + titlesContainer.AddChild(titleContainer); + // Delta-V - end of grid container change } } } diff --git a/Content.Client/Stylesheets/StyleNano.cs b/Content.Client/Stylesheets/StyleNano.cs index 5ca2d563f42..d83fd850598 100644 --- a/Content.Client/Stylesheets/StyleNano.cs +++ b/Content.Client/Stylesheets/StyleNano.cs @@ -186,6 +186,9 @@ public sealed class StyleNano : StyleBase public const string StyleClassPinButtonPinned = "pinButtonPinned"; public const string StyleClassPinButtonUnpinned = "pinButtonUnpinned"; + //Delta-V - Manifest pronouns + public const string StyleClassCrewManifestGender = "CrewManifestGender"; + public override Stylesheet Stylesheet { get; } @@ -1291,6 +1294,12 @@ public StyleNano(IResourceCache resCache) : base(resCache) .Prop("font", notoSansItalic10) .Prop("font-color", ItemStatusNotHeldColor), + // Delta-V add style for pronouns on the crew manifest + Element() + .Class(StyleClassCrewManifestGender) + .Prop("font", notoSansItalic10) + .Prop("font-style", "italic"), + Element() .Class(StyleClassItemStatus) .Prop(nameof(RichTextLabel.LineHeightScale), 0.7f) diff --git a/Content.Server/CrewManifest/CrewManifestSystem.cs b/Content.Server/CrewManifest/CrewManifestSystem.cs index e7424560159..803b14bcaa3 100644 --- a/Content.Server/CrewManifest/CrewManifestSystem.cs +++ b/Content.Server/CrewManifest/CrewManifestSystem.cs @@ -230,7 +230,8 @@ private void BuildCrewManifest(EntityUid station) foreach (var recordObject in iter) { var record = recordObject.Item2; - var entry = new CrewManifestEntry(record.Name, record.JobTitle, record.JobIcon, record.JobPrototype); + // Delta-V: Added gender to crew manifest + var entry = new CrewManifestEntry(record.Name, record.Gender.ToString().ToLowerInvariant(), record.JobTitle, record.JobIcon, record.JobPrototype); _prototypeManager.TryIndex(record.JobPrototype, out JobPrototype? job); entriesSort.Add((job, entry)); diff --git a/Content.Shared/CrewManifest/SharedCrewManifestSystem.cs b/Content.Shared/CrewManifest/SharedCrewManifestSystem.cs index a9279cc7f1f..8784f5a63e1 100644 --- a/Content.Shared/CrewManifest/SharedCrewManifestSystem.cs +++ b/Content.Shared/CrewManifest/SharedCrewManifestSystem.cs @@ -48,15 +48,18 @@ public sealed class CrewManifestEntry { public string Name { get; } + public string Gender { get; } // Delta-V: Added gender to crew manifest + public string JobTitle { get; } public string JobIcon { get; } public string JobPrototype { get; } - public CrewManifestEntry(string name, string jobTitle, string jobIcon, string jobPrototype) + public CrewManifestEntry(string name, string gender, string jobTitle, string jobIcon, string jobPrototype) { Name = name; + Gender = gender; // Delta-V: Added gender to crew manifest JobTitle = jobTitle; JobIcon = jobIcon; JobPrototype = jobPrototype; diff --git a/Resources/Locale/en-US/_DV/gender.ftl b/Resources/Locale/en-US/_DV/gender.ftl new file mode 100644 index 00000000000..1209e6afbef --- /dev/null +++ b/Resources/Locale/en-US/_DV/gender.ftl @@ -0,0 +1,6 @@ +gender-display = ({$gender -> + [male] He / Him + [female] She / Her + [neuter] It / It + *[other] They / Them +})