using Content.Client.UserInterface.Controls; using Content.Shared.Cargo; using Robust.Client.AutoGenerated; using Robust.Client.UserInterface; using Robust.Client.UserInterface.XAML; namespace Content.Client.Cargo.UI; [GenerateTypedNameReferences] public sealed partial class CargoBountyMenu : FancyWindow { public Action? OnLabelButtonPressed; public Action? OnSkipButtonPressed; public CargoBountyMenu() { RobustXamlLoader.Load(this); MasterTabContainer.SetTabTitle(0, Loc.GetString("bounty-console-tab-available-label")); MasterTabContainer.SetTabTitle(1, Loc.GetString("bounty-console-tab-history-label")); } public void UpdateEntries(List bounties, List history, TimeSpan untilNextSkip) { BountyEntriesContainer.Children.Clear(); foreach (var b in bounties) { var entry = new BountyEntry(b, untilNextSkip); entry.OnLabelButtonPressed += () => OnLabelButtonPressed?.Invoke(b.Id); entry.OnSkipButtonPressed += () => OnSkipButtonPressed?.Invoke(b.Id); BountyEntriesContainer.AddChild(entry); } BountyEntriesContainer.AddChild(new Control { MinHeight = 10 }); BountyHistoryContainer.Children.Clear(); if (history.Count == 0) { NoHistoryLabel.Visible = true; } else { NoHistoryLabel.Visible = false; // Show the history in reverse, so last entry is first in the list for (var i = history.Count - 1; i >= 0; i--) { BountyHistoryContainer.AddChild(new BountyHistoryEntry(history[i])); } } } }