using System.Numerics; using Content.Client.Message; using Content.Shared.Cargo.Prototypes; using Robust.Client.AutoGenerated; using Robust.Client.GameObjects; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; namespace Content.Client.Salvage.UI; [GenerateTypedNameReferences] public sealed partial class JobEntry : BoxContainer { public Action? OnLabelButtonPressed; public JobEntry(CargoBountyPrototype job, IEntityManager entMan) { RobustXamlLoader.Load(this); NameLabel.SetMarkup(Loc.GetString($"salv-job-board-name-{job.ID}")); var items = new List(); foreach (var entry in job.Entries) { items.Add(Loc.GetString("bounty-console-manifest-entry", ("amount", entry.Amount), ("item", Loc.GetString(entry.Name)))); } ManifestLabel.SetMarkup(Loc.GetString("job-board-ui-label-items", ("item", string.Join(", ", items)))); RewardLabel.SetMarkup(Loc.GetString("bounty-console-reward-label", ("reward", job.Reward))); DescriptionLabel.SetMarkup(Loc.GetString(job.Description)); if (job.Sprite != null) { var texture = entMan.System().Frame0(job.Sprite); // Make sure the actual size of the control is the same regardless of the texture size. IconRect.TextureScale = Vector2.One * (3f / (texture.Size.X / 32f)); IconRect.Texture = texture; } PrintButton.OnPressed += _ => OnLabelButtonPressed?.Invoke(); } }