Fix crew manifest sorting (#13286)

This commit is contained in:
Theomund
2023-01-08 22:34:43 -05:00
committed by GitHub
parent 5018c80152
commit f7629adb3e
2 changed files with 3 additions and 11 deletions

View File

@@ -106,21 +106,13 @@ public sealed partial class CrewManifestUi : DefaultWindow
if (Loc.TryGetString($"department-{sectionTitle}", out var localizedDepart)) if (Loc.TryGetString($"department-{sectionTitle}", out var localizedDepart))
sectionTitle = localizedDepart; sectionTitle = localizedDepart;
AddChild(new Label() AddChild(new Label()
{ {
StyleClasses = { "LabelBig" }, StyleClasses = { "LabelBig" },
Text = Loc.GetString(sectionTitle) Text = Loc.GetString(sectionTitle)
}); });
entries.Sort((a, b) =>
{
var posA = crewManifestSystem.GetDepartmentOrder(sectionTitle, a.JobPrototype);
var posB = crewManifestSystem.GetDepartmentOrder(sectionTitle, b.JobPrototype);
return posA.CompareTo(posB);
});
var gridContainer = new GridContainer() var gridContainer = new GridContainer()
{ {
HorizontalExpand = true, HorizontalExpand = true,
@@ -147,7 +139,7 @@ public sealed partial class CrewManifestUi : DefaultWindow
}; };
var title = new RichTextLabel(); var title = new RichTextLabel();
title.SetMessage(Loc.GetString(entry.JobTitle)); title.SetMessage(entry.JobTitle);
if (rsi != null) if (rsi != null)

View File

@@ -116,7 +116,7 @@ public sealed class StationRecordsSystem : EntitySystem
{ {
Name = name, Name = name,
Age = age, Age = age,
JobTitle = jobPrototype.Name, JobTitle = jobPrototype.LocalizedName,
JobIcon = jobPrototype.Icon, JobIcon = jobPrototype.Icon,
JobPrototype = jobId, JobPrototype = jobId,
Species = species, Species = species,