* Salvage Job Board * More development * Small boy * Computer yaml (partial) * UI * Rank unlock logic * Job label printing * appraisal tool integration * Jobs * add board to QM locker * boom! * command desc * mild rewording * ackh, mein pr ist brohken
45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
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<string>();
|
|
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<SpriteSystem>().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();
|
|
}
|
|
}
|