Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDA Bank Data #1432

Merged
merged 3 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Content.Client/PDA/PdaMenu.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
<ContainerButton Name="StationAlertLevelInstructionsButton">
<RichTextLabel Name="StationAlertLevelInstructions" Access="Public"/>
</ContainerButton>
<ContainerButton Name="BalanceButton">
<RichTextLabel Name="BalanceLabel" Access="Public"/>
</ContainerButton>
</BoxContainer>
<ScrollContainer HorizontalExpand="True" VerticalExpand="True" HScrollEnabled="True">
<BoxContainer Orientation="Vertical"
Expand Down
12 changes: 10 additions & 2 deletions Content.Client/PDA/PdaMenu.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public sealed partial class PdaMenu : PdaWindow
private string _stationName = Loc.GetString("comp-pda-ui-unknown");
private string _alertLevel = Loc.GetString("comp-pda-ui-unknown");
private string _instructions = Loc.GetString("comp-pda-ui-unknown");


private string _balance = Loc.GetString("comp-pda-ui-unknown"); // Frontier

private int _currentView;

Expand Down Expand Up @@ -115,6 +116,11 @@ public PdaMenu()
_clipboard.SetText(_alertLevel);
};

BalanceButton.OnPressed += _ => // Frontier
{
_clipboard.SetText(_balance);
};

StationTimeButton.OnPressed += _ =>
{
var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);
Expand Down Expand Up @@ -161,7 +167,9 @@ public void UpdateState(PdaUpdateState state)
_stationName = state.StationName ?? Loc.GetString("comp-pda-ui-unknown");
StationNameLabel.SetMarkup(Loc.GetString("comp-pda-ui-station",
("station", _stationName)));


_balance = Loc.GetString("comp-pda-ui-balance", ("balance", state.Balance)); // Frontier
BalanceLabel.SetMarkup(_balance); // Frontier
Cheackraze marked this conversation as resolved.
Show resolved Hide resolved

var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);

Expand Down
9 changes: 7 additions & 2 deletions Content.Server/PDA/PdaSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using Robust.Shared.Containers;
using Robust.Shared.Player;
using Robust.Shared.Utility;
using Content.Shared.Bank.Components; // Frontier

namespace Content.Server.PDA
{
Expand Down Expand Up @@ -142,7 +143,7 @@ private void OnNotification(Entity<PdaComponent> ent, ref CartridgeLoaderNotific
/// <summary>
/// Send new UI state to clients, call if you modify something like uplink.
/// </summary>
public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null)
public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null, EntityUid? actor_uid = null) // Frontier
{
if (!Resolve(uid, ref pda, false))
return;
Expand All @@ -165,6 +166,9 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null)

var programs = _cartridgeLoader.GetAvailablePrograms(uid, loader);
var id = CompOrNull<IdCardComponent>(pda.ContainedId);
var balance = 0; // frontier
if (actor_uid != null && TryComp<BankAccountComponent>(actor_uid, out var account)) // frontier
balance = account.Balance; // frontier
var state = new PdaUpdateState(
programs,
GetNetEntity(loader.ActiveProgram),
Expand All @@ -180,6 +184,7 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null)
StationAlertLevel = pda.StationAlertLevel,
StationAlertColor = pda.StationAlertColor
},
balance, // Frontier
pda.StationName,
showUplink,
hasInstrument,
Expand All @@ -193,7 +198,7 @@ private void OnPdaOpen(Entity<PdaComponent> ent, ref BoundUIOpenedEvent args)
if (!PdaUiKey.Key.Equals(args.UiKey))
return;

UpdatePdaUi(ent.Owner, ent.Comp);
UpdatePdaUi(ent.Owner, ent.Comp, args.Actor); // Frontier
}

private void OnUiMessage(EntityUid uid, PdaComponent pda, PdaRequestUpdateInterfaceMessage msg)
Expand Down
3 changes: 3 additions & 0 deletions Content.Shared/PDA/PdaUpdateState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public sealed class PdaUpdateState : CartridgeLoaderUiState // WTF is this. what
public bool HasUplink;
public bool CanPlayMusic;
public string? Address;
public int Balance; // Frontier

public PdaUpdateState(
List<NetEntity> programs,
Expand All @@ -26,6 +27,7 @@ public PdaUpdateState(
bool hasPai,
bool hasBook,
PdaIdInfoText pdaOwnerInfo,
int balance, // Frontier
string? stationName,
bool hasUplink = false,
bool canPlayMusic = false,
Expand All @@ -41,6 +43,7 @@ public PdaUpdateState(
CanPlayMusic = canPlayMusic;
StationName = stationName;
Address = address;
Balance = balance; // Frontier
}
}

Expand Down
1 change: 1 addition & 0 deletions Resources/Locale/en-US/_NF/pda/pda-component.ftl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
comp-pda-ui-balance = Balance: [color=white]{ $balance }[/color]
Loading