Files
tbd-station-14/Content.Shared/CrewManifest/SharedCrewManifestSystem.cs
Pieter-Jan Briers 715794dd41 Make department / job list sorting consistent. (#25486)
* Make department / job list sorting consistent.

This makes late join, crew manifest and character profile all apply consistent sorting for jobs and departments.

We use the already-defined weights for departments (so command, then sec, then station specific, then just sort by prototype ID). Jobs also use weight (so heads are always at the top) then prototype ID, then character name (for manifest).

Removed the crewmanifest.ordering CVar as doing it via prototype weight is just easier, and that CVar was already a mess anyways.

* Fix jittery job icons in lists.

They were set to KeepCentered in TextureRect. This has issues because the allocated space is actually an odd number of pixels, so it tries to position the draw at a half pixel offset.

Now, yes, fixing this in TextureRect would make much more sense, but get off my back. (Ok seriously we need better helper functions for doing that in the engine. Don't wanna deal with that right now and I already have this patch made.)

Instead I'm just gonna fix the issue by using VerticalAlignment in all these places instead which ends up doing exactly the same thing YIPPEE.

Also gave a margin next to the icon on the crew manifest. Margins people!
2024-02-23 15:04:44 +11:00

73 lines
1.9 KiB
C#

using Content.Shared.Eui;
using NetSerializer;
using Robust.Shared.Serialization;
namespace Content.Shared.CrewManifest;
/// <summary>
/// A message to send to the server when requesting a crew manifest.
/// CrewManifestSystem will open an EUI that will send the crew manifest
/// to the player when it is updated.
/// </summary>
[Serializable, NetSerializable]
public sealed class RequestCrewManifestMessage : EntityEventArgs
{
public NetEntity Id { get; }
public RequestCrewManifestMessage(NetEntity id)
{
Id = id;
}
}
[Serializable, NetSerializable]
public sealed class CrewManifestEuiState : EuiStateBase
{
public string StationName { get; }
public CrewManifestEntries? Entries { get; }
public CrewManifestEuiState(string stationName, CrewManifestEntries? entries)
{
StationName = stationName;
Entries = entries;
}
}
[Serializable, NetSerializable]
public sealed class CrewManifestEntries
{
/// <summary>
/// Entries in the crew manifest. Goes by department ID.
/// </summary>
// public Dictionary<string, List<CrewManifestEntry>> Entries = new();
public CrewManifestEntry[] Entries = Array.Empty<CrewManifestEntry>();
}
[Serializable, NetSerializable]
public sealed class CrewManifestEntry
{
public string Name { get; }
public string JobTitle { get; }
public string JobIcon { get; }
public string JobPrototype { get; }
public CrewManifestEntry(string name, string jobTitle, string jobIcon, string jobPrototype)
{
Name = name;
JobTitle = jobTitle;
JobIcon = jobIcon;
JobPrototype = jobPrototype;
}
}
/// <summary>
/// Tells the server to open a crew manifest UI from
/// this entity's point of view.
/// </summary>
[Serializable, NetSerializable]
public sealed class CrewManifestOpenUiMessage : BoundUserInterfaceMessage
{}