From c46df7ee3c285b63df42961cb74fa6e6b26c6a6c Mon Sep 17 00:00:00 2001 From: Dvir Date: Tue, 28 May 2024 01:38:32 +0300 Subject: [PATCH 1/3] Bank data --- Content.Client/PDA/PdaMenu.xaml | 3 +++ Content.Client/PDA/PdaMenu.xaml.cs | 12 ++++++++++-- Content.Server/PDA/PdaSystem.cs | 6 +++++- Resources/Locale/en-US/_NF/pda/pda-component.ftl | 1 + 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 Resources/Locale/en-US/_NF/pda/pda-component.ftl diff --git a/Content.Client/PDA/PdaMenu.xaml b/Content.Client/PDA/PdaMenu.xaml index cc4a384343a..8f9a297afc2 100644 --- a/Content.Client/PDA/PdaMenu.xaml +++ b/Content.Client/PDA/PdaMenu.xaml @@ -47,6 +47,9 @@ + + + // Frontier + { + _clipboard.SetText(_balance); + }; + StationTimeButton.OnPressed += _ => { var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); @@ -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 var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); diff --git a/Content.Server/PDA/PdaSystem.cs b/Content.Server/PDA/PdaSystem.cs index b91f2522b20..f82215d8707 100644 --- a/Content.Server/PDA/PdaSystem.cs +++ b/Content.Server/PDA/PdaSystem.cs @@ -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 { @@ -142,7 +143,7 @@ private void OnNotification(Entity ent, ref CartridgeLoaderNotific /// /// Send new UI state to clients, call if you modify something like uplink. /// - 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; @@ -165,6 +166,9 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null) var programs = _cartridgeLoader.GetAvailablePrograms(uid, loader); var id = CompOrNull(pda.ContainedId); + var balance = 0; // frontier + if (actor_uid != null && TryComp(actor_uid, out var account)) // frontier + balance = account.Balance; // frontier var state = new PdaUpdateState( programs, GetNetEntity(loader.ActiveProgram), diff --git a/Resources/Locale/en-US/_NF/pda/pda-component.ftl b/Resources/Locale/en-US/_NF/pda/pda-component.ftl new file mode 100644 index 00000000000..2199713dbf8 --- /dev/null +++ b/Resources/Locale/en-US/_NF/pda/pda-component.ftl @@ -0,0 +1 @@ +comp-pda-ui-balance = Balance: [color=white]{ $balance }[/color] From e273ed633cd8316b2bb5fa1bb6a012d04252faad Mon Sep 17 00:00:00 2001 From: Dvir Date: Tue, 28 May 2024 01:39:09 +0300 Subject: [PATCH 2/3] Data --- Content.Server/PDA/PdaSystem.cs | 3 ++- Content.Shared/PDA/PdaUpdateState.cs | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Content.Server/PDA/PdaSystem.cs b/Content.Server/PDA/PdaSystem.cs index f82215d8707..4919d2a5f9d 100644 --- a/Content.Server/PDA/PdaSystem.cs +++ b/Content.Server/PDA/PdaSystem.cs @@ -184,6 +184,7 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null, EntityUid? acto StationAlertLevel = pda.StationAlertLevel, StationAlertColor = pda.StationAlertColor }, + balance, // Frontier pda.StationName, showUplink, hasInstrument, @@ -197,7 +198,7 @@ private void OnPdaOpen(Entity 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) diff --git a/Content.Shared/PDA/PdaUpdateState.cs b/Content.Shared/PDA/PdaUpdateState.cs index 4b0c8ccba5b..e98f0f0f64f 100644 --- a/Content.Shared/PDA/PdaUpdateState.cs +++ b/Content.Shared/PDA/PdaUpdateState.cs @@ -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 programs, @@ -26,6 +27,7 @@ public PdaUpdateState( bool hasPai, bool hasBook, PdaIdInfoText pdaOwnerInfo, + int balance, // Frontier string? stationName, bool hasUplink = false, bool canPlayMusic = false, @@ -41,6 +43,7 @@ public PdaUpdateState( CanPlayMusic = canPlayMusic; StationName = stationName; Address = address; + Balance = balance; // Frontier } } From 18c044e811d7d8d63fdde7bd6994fc3305445a9e Mon Sep 17 00:00:00 2001 From: Checkraze <71046427+Cheackraze@users.noreply.github.com> Date: Wed, 5 Jun 2024 19:34:03 -0400 Subject: [PATCH 3/3] Update Content.Client/PDA/PdaMenu.xaml.cs Co-authored-by: whatston3 <166147148+whatston3@users.noreply.github.com> --- Content.Client/PDA/PdaMenu.xaml.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Content.Client/PDA/PdaMenu.xaml.cs b/Content.Client/PDA/PdaMenu.xaml.cs index 47c6fe71a3b..d294e4ba545 100644 --- a/Content.Client/PDA/PdaMenu.xaml.cs +++ b/Content.Client/PDA/PdaMenu.xaml.cs @@ -168,8 +168,8 @@ public void UpdateState(PdaUpdateState state) 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 + _balance = state.Balance.ToString(); // Frontier + BalanceLabel.SetMarkup(Loc.GetString("comp-pda-ui-balance", ("balance", _balance))); // Frontier var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan);