forked from DeltaV-Station/Delta-v
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add history tab to bounty console (DeltaV-Station#2473)
* 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
- Loading branch information
1 parent
93c13b4
commit 600ef0e
Showing
10 changed files
with
191 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<BoxContainer xmlns="https://spacestation14.io" | ||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
Margin="10 10 10 0" | ||
HorizontalExpand="True" | ||
Visible="True"> | ||
<PanelContainer StyleClasses="AngleRect" HorizontalExpand="True"> | ||
<BoxContainer Orientation="Vertical" | ||
HorizontalExpand="True"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True"> | ||
<RichTextLabel Name="RewardLabel"/> | ||
<RichTextLabel Name="ManifestLabel"/> | ||
<RichTextLabel Name="NoticeLabel"/> | ||
</BoxContainer> | ||
<Control MinWidth="10"/> | ||
<BoxContainer Orientation="Vertical" MinWidth="120"> | ||
<RichTextLabel Name="StatusLabel" HorizontalAlignment="Right" Margin="0 0 5 0"/> | ||
<RichTextLabel Name="IdLabel" HorizontalAlignment="Right" Margin="0 0 5 0"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</PanelContainer> | ||
</BoxContainer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using Content.Client.Message; | ||
using Content.Shared.Cargo; | ||
using Content.Shared.Cargo.Prototypes; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Client.Cargo.UI; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class BountyHistoryEntry : BoxContainer | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototype = default!; | ||
|
||
public BountyHistoryEntry(CargoBountyHistoryData bounty) | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
|
||
if (!_prototype.TryIndex<CargoBountyPrototype>(bounty.Bounty, out var bountyPrototype)) | ||
return; | ||
|
||
var items = new List<string>(); | ||
foreach (var entry in bountyPrototype.Entries) | ||
{ | ||
items.Add(Loc.GetString("bounty-console-manifest-entry", | ||
("amount", entry.Amount), | ||
("item", Loc.GetString(entry.Name)))); | ||
} | ||
ManifestLabel.SetMarkup(Loc.GetString("bounty-console-manifest-label", ("item", string.Join(", ", items)))); | ||
RewardLabel.SetMarkup(Loc.GetString("bounty-console-reward-label", ("reward", bountyPrototype.Reward))); | ||
IdLabel.SetMarkup(Loc.GetString("bounty-console-id-label", ("id", bounty.Id))); | ||
|
||
var stationTime = bounty.Timestamp.ToString("hh\\:mm\\:ss"); | ||
if (bounty.ActorName == null) | ||
{ | ||
StatusLabel.SetMarkup(Loc.GetString("bounty-console-history-completed-label")); | ||
NoticeLabel.SetMarkup(Loc.GetString("bounty-console-history-notice-completed-label", ("time", stationTime))); | ||
} | ||
else | ||
{ | ||
StatusLabel.SetMarkup(Loc.GetString("bounty-console-history-skipped-label")); | ||
NoticeLabel.SetMarkup(Loc.GetString("bounty-console-history-notice-skipped-label", | ||
("id", bounty.ActorName), | ||
("time", stationTime))); | ||
} | ||
} | ||
protected override void FrameUpdate(FrameEventArgs args) | ||
{ | ||
base.FrameUpdate(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
using Robust.Shared.Serialization; | ||
using Content.Shared.Cargo.Prototypes; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Shared.Cargo; | ||
|
||
/// <summary> | ||
/// A data structure for storing historical information about bounties. | ||
/// </summary> | ||
[DataDefinition, NetSerializable, Serializable] | ||
public readonly partial record struct CargoBountyHistoryData | ||
{ | ||
/// <summary> | ||
/// A unique id used to identify the bounty | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public string Id { get; init; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Optional name of the actor that skipped the bounty. | ||
/// Only set when the bounty has been skipped. | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public string? ActorName { get; init; } = default; | ||
|
||
/// <summary> | ||
/// Time when this bounty was completed or skipped | ||
/// </summary> | ||
[DataField, ViewVariables(VVAccess.ReadWrite)] | ||
public TimeSpan Timestamp { get; init; } = TimeSpan.MinValue; | ||
|
||
/// <summary> | ||
/// The prototype containing information about the bounty. | ||
/// </summary> | ||
[ViewVariables(VVAccess.ReadWrite)] | ||
[DataField(required: true)] | ||
public ProtoId<CargoBountyPrototype> Bounty { get; init; } = string.Empty; | ||
|
||
public CargoBountyHistoryData(CargoBountyData bounty, TimeSpan timestamp, string? actorName) | ||
{ | ||
Bounty = bounty.Bounty; | ||
Id = bounty.Id; | ||
ActorName = actorName; | ||
Timestamp = timestamp; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters