Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pronouns to crew manifest #2647

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 44 additions & 6 deletions Content.Client/CrewManifest/UI/CrewManifestSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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);
FaintSpeaker marked this conversation as resolved.
Show resolved Hide resolved
// Delta-V - end of grid container change
}
}
}
9 changes: 9 additions & 0 deletions Content.Client/Stylesheets/StyleNano.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }

Expand Down Expand Up @@ -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<RichTextLabel>()
.Class(StyleClassCrewManifestGender)
.Prop("font", notoSansItalic10)
.Prop("font-style", "italic"),

Element<RichTextLabel>()
.Class(StyleClassItemStatus)
.Prop(nameof(RichTextLabel.LineHeightScale), 0.7f)
Expand Down
3 changes: 2 additions & 1 deletion Content.Server/CrewManifest/CrewManifestSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
5 changes: 4 additions & 1 deletion Content.Shared/CrewManifest/SharedCrewManifestSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions Resources/Locale/en-US/_DV/gender.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
gender-display = ({$gender ->
[male] He / Him
[female] She / Her
[neuter] It / It
*[other] They / Them
})
Loading