* Add struct for holding historical data on cargo bounties * Add localisation strings for bounty history * Add new XAML entry for display bounty history * Expand cargo bounty menu to include tabs * Ensure station databases hold historical bounty data * Add to the bounty history when removing one from active * Feed bounty history into cargo's bounty system * Move tab title setting to constructor * Remove redundant access specifications * Remove un-needed override * Fixup BountyHistoryEntry backing code * Fix formatting in CargoBountyMenu * Reformat BountyHistoryData * Rework TryRemoveBounty to use new Entity type * Add Enum for showing bounty results * Rework look and feel of History tab * Add visible text when no bounties have been completed yet * Remove control * Swap default to null * Reverse ordering of bounties so last entry comes first * Remove redundant Visible * Move enum docs into the enum
56 lines
1.7 KiB
C#
56 lines
1.7 KiB
C#
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<string>? OnLabelButtonPressed;
|
|
public Action<string>? 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<CargoBountyData> bounties, List<CargoBountyHistoryData> 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]));
|
|
}
|
|
}
|
|
}
|
|
}
|