| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- using Content.Shared.CrewManifest;
- using Content.Shared.StatusIcon;
- using Robust.Client.GameObjects;
- using Robust.Client.UserInterface.Controls;
- using Robust.Shared.Prototypes;
- using System.Numerics;
- using Content.Shared.Roles;
- namespace Content.Client.CrewManifest.UI;
- public sealed class CrewManifestSection : BoxContainer
- {
- public CrewManifestSection(
- IPrototypeManager prototypeManager,
- SpriteSystem spriteSystem,
- DepartmentPrototype section,
- List<CrewManifestEntry> entries)
- {
- Orientation = LayoutOrientation.Vertical;
- HorizontalExpand = true;
- AddChild(new Label()
- {
- StyleClasses = { "LabelBig" },
- Text = Loc.GetString(section.Name)
- });
- var gridContainer = new GridContainer()
- {
- HorizontalExpand = true,
- Columns = 2
- };
- AddChild(gridContainer);
- foreach (var entry in entries)
- {
- var name = new RichTextLabel()
- {
- HorizontalExpand = true,
- };
- name.SetMessage(entry.Name);
- var titleContainer = new BoxContainer()
- {
- Orientation = LayoutOrientation.Horizontal,
- HorizontalExpand = true
- };
- var title = new RichTextLabel();
- title.SetMessage(entry.JobTitle);
- if (prototypeManager.TryIndex<JobIconPrototype>(entry.JobIcon, out var jobIcon))
- {
- var icon = new TextureRect()
- {
- TextureScale = new Vector2(2, 2),
- VerticalAlignment = VAlignment.Center,
- Texture = spriteSystem.Frame0(jobIcon.Icon),
- Margin = new Thickness(0, 0, 4, 0)
- };
- titleContainer.AddChild(icon);
- titleContainer.AddChild(title);
- }
- else
- {
- titleContainer.AddChild(title);
- }
- gridContainer.AddChild(name);
- gridContainer.AddChild(titleContainer);
- }
- }
- }
|