From 78b17b0a019e57617a42d36b262186690ca0e9c0 Mon Sep 17 00:00:00 2001 From: dffdff2423 <57052305+dffdff2423@users.noreply.github.com> Date: Sat, 30 Mar 2024 11:21:06 -0500 Subject: [PATCH] fix new SecurityStatuses in the CD record computer (#210) Wizden added some new security statues that required some minor alterations to our record computer. --- .../CharacterRecordConsoleBoundUserInterface.cs | 9 ++------- .../_CD/Records/UI/CharacterRecordViewer.xaml.cs | 16 ++++++++-------- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Content.Client/_CD/Records/UI/CharacterRecordConsoleBoundUserInterface.cs b/Content.Client/_CD/Records/UI/CharacterRecordConsoleBoundUserInterface.cs index e0e2fd5345c..c1da4bdb331 100644 --- a/Content.Client/_CD/Records/UI/CharacterRecordConsoleBoundUserInterface.cs +++ b/Content.Client/_CD/Records/UI/CharacterRecordConsoleBoundUserInterface.cs @@ -65,14 +65,9 @@ protected override void Open() SendMessage(new CharacterRecordsConsoleFilterMsg(new StationRecordsFilter(ty, txt))); }; - _window.OnSetSecurityStatus += status => + _window.OnSetSecurityStatus += (status, reason) => { - SendMessage(new CriminalRecordChangeStatus(status, null)); - }; - - _window.OnSetWantedStatus += reason => - { - SendMessage(new CriminalRecordChangeStatus(SecurityStatus.Wanted, reason)); + SendMessage(new CriminalRecordChangeStatus(status, reason)); }; _window.OpenCentered(); diff --git a/Content.Client/_CD/Records/UI/CharacterRecordViewer.xaml.cs b/Content.Client/_CD/Records/UI/CharacterRecordViewer.xaml.cs index f203a335f85..bba1390849b 100644 --- a/Content.Client/_CD/Records/UI/CharacterRecordViewer.xaml.cs +++ b/Content.Client/_CD/Records/UI/CharacterRecordViewer.xaml.cs @@ -24,8 +24,7 @@ public sealed partial class CharacterRecordViewer : FancyWindow private List? _entries; private DialogWindow? _wantedReasonDialog; - public event Action? OnSetWantedStatus; - public event Action? OnSetSecurityStatus; + public event Action? OnSetSecurityStatus; public uint? SecurityWantedStatusMaxLength; @@ -101,10 +100,11 @@ public CharacterRecordViewer() StatusOptionButton.OnItemSelected += args => { var status = (SecurityStatus)args.Id; - if (status == SecurityStatus.Wanted) - SetWantedStatus(); + // This should reflect SetStatus in CriminalRecordsConsoleWindow.xaml.cs + if (status == SecurityStatus.Wanted || status == SecurityStatus.Suspected) + SetStatusWithReason(status); else - OnSetSecurityStatus?.Invoke(status); + OnSetSecurityStatus?.Invoke(status, null); }; OnClose += () => _entryView.Close(); @@ -318,7 +318,7 @@ private void UpdateRecordBoxSecurity(FullCharacterRecords record, (SecurityStatu } // This is copied almost verbatim from CriminalRecordsConsoleWindow.xaml.cs - private void SetWantedStatus() + private void SetStatusWithReason(SecurityStatus status) { if (_wantedReasonDialog != null) { @@ -327,7 +327,7 @@ private void SetWantedStatus() } const string field = "reason"; - var title = Loc.GetString("criminal-records-status-wanted"); + var title = Loc.GetString("criminal-records-status-" + status.ToString().ToLower()); var placeholder = Loc.GetString("cd-character-records-viewer-setwanted-placeholder"); var prompt = Loc.GetString("criminal-records-console-reason"); var entry = new QuickDialogEntry(field, QuickDialogEntryType.LongText, prompt, placeholder); @@ -340,7 +340,7 @@ private void SetWantedStatus() if (reason.Length < 1 || reason.Length > SecurityWantedStatusMaxLength) return; - OnSetWantedStatus?.Invoke(reason); + OnSetSecurityStatus?.Invoke(status, reason); }; _wantedReasonDialog.OnClose += () => { _wantedReasonDialog = null; };