Files
tbd-station-14/Content.Shared/Cargo/Components/CargoBountyConsoleComponent.cs
BarryNorfolk 18592148f7 Add history tab to bounty console (#33932)
* 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
2025-01-30 09:27:36 -08:00

85 lines
2.6 KiB
C#

using Robust.Shared.Audio;
using Robust.Shared.Prototypes;
using Robust.Shared.Serialization;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Cargo.Components;
[RegisterComponent]
public sealed partial class CargoBountyConsoleComponent : Component
{
/// <summary>
/// The id of the label entity spawned by the print label button.
/// </summary>
[DataField("bountyLabelId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
public string BountyLabelId = "PaperCargoBountyManifest";
/// <summary>
/// The time at which the console will be able to print a label again.
/// </summary>
[DataField("nextPrintTime", customTypeSerializer: typeof(TimeOffsetSerializer))]
public TimeSpan NextPrintTime = TimeSpan.Zero;
/// <summary>
/// The time between prints.
/// </summary>
[DataField("printDelay")]
public TimeSpan PrintDelay = TimeSpan.FromSeconds(5);
/// <summary>
/// The sound made when printing occurs
/// </summary>
[DataField("printSound")]
public SoundSpecifier PrintSound = new SoundPathSpecifier("/Audio/Machines/printer.ogg");
/// <summary>
/// The sound made when the bounty is skipped.
/// </summary>
[DataField("skipSound")]
public SoundSpecifier SkipSound = new SoundPathSpecifier("/Audio/Effects/Cargo/ping.ogg");
/// <summary>
/// The sound made when bounty skipping is denied due to lacking access.
/// </summary>
[DataField("denySound")]
public SoundSpecifier DenySound = new SoundPathSpecifier("/Audio/Effects/Cargo/buzz_two.ogg");
}
[NetSerializable, Serializable]
public sealed class CargoBountyConsoleState : BoundUserInterfaceState
{
public List<CargoBountyData> Bounties;
public List<CargoBountyHistoryData> History;
public TimeSpan UntilNextSkip;
public CargoBountyConsoleState(List<CargoBountyData> bounties, List<CargoBountyHistoryData> history, TimeSpan untilNextSkip)
{
Bounties = bounties;
History = history;
UntilNextSkip = untilNextSkip;
}
}
[Serializable, NetSerializable]
public sealed class BountyPrintLabelMessage : BoundUserInterfaceMessage
{
public string BountyId;
public BountyPrintLabelMessage(string bountyId)
{
BountyId = bountyId;
}
}
[Serializable, NetSerializable]
public sealed class BountySkipMessage : BoundUserInterfaceMessage
{
public string BountyId;
public BountySkipMessage(string bountyId)
{
BountyId = bountyId;
}
}