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 @@ + + + + { + _clipboard.SetText(_balance); + }; + StationTimeButton.OnPressed += _ => { var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); @@ -126,7 +131,7 @@ public PdaMenu() _clipboard.SetText(_instructions); }; - + HideAllViews(); @@ -161,7 +166,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)); + BalanceLabel.SetMarkup(_balance); var stationTime = _gameTiming.CurTime.Subtract(_gameTicker.RoundStartTimeSpan); diff --git a/Content.Server/PDA/PdaSystem.cs b/Content.Server/PDA/PdaSystem.cs index b91f2522b20..33a0eb9fc97 100644 --- a/Content.Server/PDA/PdaSystem.cs +++ b/Content.Server/PDA/PdaSystem.cs @@ -2,6 +2,7 @@ using Content.Server.CartridgeLoader; using Content.Server.Chat.Managers; using Content.Server.DeviceNetwork.Components; +using Content.Shared.Bank.Components; using Content.Server.Instruments; using Content.Server.Light.EntitySystems; using Content.Server.PDA.Ringer; @@ -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) { if (!Resolve(uid, ref pda, false)) return; @@ -165,6 +166,12 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null) var programs = _cartridgeLoader.GetAvailablePrograms(uid, loader); var id = CompOrNull(pda.ContainedId); + ulong balance = 0; + if (actor_uid != null){ + if (TryComp(actor_uid, out var bank)) { + balance = (ulong)bank.Balance; + } + } var state = new PdaUpdateState( programs, GetNetEntity(loader.ActiveProgram), @@ -180,6 +187,7 @@ public void UpdatePdaUi(EntityUid uid, PdaComponent? pda = null) StationAlertLevel = pda.StationAlertLevel, StationAlertColor = pda.StationAlertColor }, + balance, pda.StationName, showUplink, hasInstrument, @@ -193,7 +201,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); } 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..d3f406f5095 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 ulong Balance; public PdaUpdateState( List programs, @@ -26,6 +27,7 @@ public PdaUpdateState( bool hasPai, bool hasBook, PdaIdInfoText pdaOwnerInfo, + ulong balance, string? stationName, bool hasUplink = false, bool canPlayMusic = false, @@ -41,6 +43,7 @@ public PdaUpdateState( CanPlayMusic = canPlayMusic; StationName = stationName; Address = address; + Balance = balance; } } diff --git a/Content.Shared/Species/Systems/ReformSystem.cs b/Content.Shared/Species/Systems/ReformSystem.cs index b7f32b41bd1..d5c735ab2a8 100644 --- a/Content.Shared/Species/Systems/ReformSystem.cs +++ b/Content.Shared/Species/Systems/ReformSystem.cs @@ -120,7 +120,7 @@ private void OnZombified(EntityUid uid, ReformComponent comp, ref EntityZombifie } public sealed partial class ReformEvent : InstantActionEvent { } - + [Serializable, NetSerializable] public sealed partial class ReformDoAfterEvent : SimpleDoAfterEvent { } diff --git a/Resources/Locale/en-US/pda/pda-component.ftl b/Resources/Locale/en-US/pda/pda-component.ftl index 7f17102c5f0..b38ac9bb218 100644 --- a/Resources/Locale/en-US/pda/pda-component.ftl +++ b/Resources/Locale/en-US/pda/pda-component.ftl @@ -54,3 +54,5 @@ comp-pda-ui-unassigned = Unassigned pda-notification-message = [font size=12][bold]PDA[/bold] { $header }: [/font] "{ $message }" + +comp-pda-ui-balance = Balance: [color=white]{ $balance }[/color] diff --git a/Resources/Locale/ru-RU/pda/pda-component.ftl b/Resources/Locale/ru-RU/pda/pda-component.ftl index a0549ca97d7..43656ee32a1 100644 --- a/Resources/Locale/ru-RU/pda/pda-component.ftl +++ b/Resources/Locale/ru-RU/pda/pda-component.ftl @@ -29,3 +29,4 @@ comp-pda-ui-unknown = Неизвестно comp-pda-ui-unassigned = Не назначено pda-notification-message = [font size=12][bold]КПК[/bold] { $header }: [/font] "{ $message }" +comp-pda-ui-balance = Баланс: [color=white]{ $balance }[/color]