Skip to content

Commit d806e64

Browse files
authored
Updare StationRecords (#478)
* commit init * migration data base * update DataBase * Fix UI records * Update records * Print Init * PrintUpdate * fix * language Add
1 parent 8f14804 commit d806e64

File tree

39 files changed

+5644
-57
lines changed

39 files changed

+5644
-57
lines changed

Content.Client/CriminalRecords/CriminalRecordsConsoleBoundUserInterface.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Content.Shared._WL.Records; // WL-Records
12
using Content.Shared.Access.Systems;
23
using Content.Shared.CriminalRecords;
34
using Content.Shared.CriminalRecords.Components;
@@ -44,6 +45,10 @@ protected override void Open()
4445
_window.OnHistoryUpdated += UpdateHistory;
4546
_window.OnHistoryClosed += () => _historyWindow?.Close();
4647
_window.OnClose += Close;
48+
// WL-Records-start
49+
_window.OnPrinted += key =>
50+
SendMessage(new PrintStationRecord(key));
51+
// WL-Records-end
4752

4853
_historyWindow = new(comp.MaxStringLength);
4954
_historyWindow.OnAddHistory += line => SendMessage(new CriminalRecordAddHistory(line));

Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
StyleClasses="LabelBig" />
6363
<BoxContainer Orientation="Horizontal"
6464
Margin="0 0 0 5">
65-
<Label Text="{Loc 'crew-monitoring-user-interface-job'}"
65+
<Label Text="{Loc 'crew-monitoring-ui-job-label'}"
6666
FontColorOverride="DarkGray" />
6767
<TextureRect Name="PersonJobIcon"
6868
TextureScale="2 2"
@@ -115,11 +115,12 @@
115115
<BoxContainer Orientation="Vertical"
116116
VerticalExpand="True"
117117
HorizontalExpand="True">
118-
<ScrollContainer VerticalExpand="True" HorizontalExpand="True">
118+
<ScrollContainer VerticalExpand="True" HScrollEnabled="False">
119119
<RichTextLabel Name="SecurityRecord"
120120
Margin="5"
121121
HorizontalExpand="True"/>
122122
</ScrollContainer>
123+
<Button Name="PrintButton" Text="{Loc 'records-print-button'}" MinWidth="200"/>
123124
</BoxContainer>
124125
</TabContainer>
125126
<!-- WL-Records-Edit-End -->

Content.Client/CriminalRecords/CriminalRecordsConsoleWindow.xaml.cs

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
using Content.Client.UserInterface.Controls;
2+
using Content.Shared._WL.Languages;
3+
using Content.Shared._WL.Records; // WL-Records-Start
24
using Content.Shared.Access.Systems;
35
using Content.Shared.Administration;
46
using Content.Shared.CriminalRecords;
57
using Content.Shared.Dataset;
8+
using Content.Shared.Humanoid.Prototypes; // WL-Records
69
using Content.Shared.Random.Helpers;
710
using Content.Shared.Security;
811
using Content.Shared.StationRecords;
12+
using Content.Shared.StatusIcon;
913
using Robust.Client.AutoGenerated;
14+
using Robust.Client.GameObjects;
1015
using Robust.Client.Player;
1116
using Robust.Client.UserInterface.Controls;
1217
using Robust.Client.UserInterface.XAML;
@@ -15,8 +20,6 @@
1520
using Robust.Shared.Utility;
1621
using System.Linq;
1722
using System.Numerics;
18-
using Content.Shared.StatusIcon;
19-
using Robust.Client.GameObjects;
2023

2124
namespace Content.Client.CriminalRecords;
2225

@@ -42,6 +45,7 @@ public sealed partial class CriminalRecordsConsoleWindow : FancyWindow
4245
public Action<CriminalRecord, bool, bool>? OnHistoryUpdated;
4346
public Action? OnHistoryClosed;
4447
public Action<SecurityStatus, string>? OnDialogConfirmed;
48+
public Action<uint>? OnPrinted; // WL-Records
4549

4650
public Action<SecurityStatus>? OnStatusFilterPressed;
4751
private uint _maxLength;
@@ -148,6 +152,15 @@ public CriminalRecordsConsoleWindow(EntityUid console, uint maxLength, IPlayerMa
148152
if (_selectedRecord is { } record)
149153
OnHistoryUpdated?.Invoke(record, _access, true);
150154
};
155+
156+
// WL-Records-start
157+
PrintButton.OnPressed += _ =>
158+
{
159+
PrintButton.Disabled = true;
160+
if (_selectedKey != null)
161+
OnPrinted?.Invoke(_selectedKey.Value);
162+
};
163+
// WL-Records-end
151164
}
152165

153166
public void StatusFilterPressed(SecurityStatus statusSelected)
@@ -175,6 +188,8 @@ public void UpdateState(CriminalRecordsConsoleState state)
175188
_currentCrewListFilter = state.FilterStatus;
176189
}
177190

191+
PrintButton.Disabled = !state.CanPrintRecords; // WL-Records
192+
178193
_selectedKey = state.SelectedKey;
179194
FilterType.SelectId((int)_currentFilterType);
180195
CrewListFilter.SelectId((int)_currentCrewListFilter);
@@ -266,9 +281,26 @@ private void PopulateRecordContainer(GeneralStationRecord stationRecord, Crimina
266281
}
267282

268283
// WL-Records-Start
269-
SecurityRecord.Text = !string.IsNullOrEmpty(stationRecord.SecurityRecord)
270-
? stationRecord.SecurityRecord
271-
: Loc.GetString("criminal-records-console-no-security-record");
284+
var confederation = string.Empty;
285+
286+
if (_proto.TryIndex<ConfederationRecordsPrototype>(stationRecord.Confederation, out var protoConf))
287+
confederation = Loc.GetString(protoConf.Name);
288+
else
289+
confederation = Loc.GetString("generic-not-available-shorthand");
290+
291+
SecurityRecord.Text = $"""
292+
{Loc.GetString("records-full-name-edit")} {(!string.IsNullOrEmpty(stationRecord.Fullname)
293+
? stationRecord.Fullname : stationRecord.Name)}
294+
{Loc.GetString("records-date-of-birth-edit")} {(!string.IsNullOrEmpty(stationRecord.DateOfBirth)
295+
? stationRecord.DateOfBirth : Loc.GetString("generic-not-available-shorthand"))}
296+
{Loc.GetString("records-confederation-edit")} {confederation}
297+
{Loc.GetString("records-country-edit")} {(!string.IsNullOrEmpty(stationRecord.Country)
298+
? stationRecord.Country : Loc.GetString("generic-not-available-shorthand"))}
299+
{Loc.GetString("records-species")} {Loc.GetString(_proto.Index<SpeciesPrototype>(stationRecord.Species).Name)}
300+
{Loc.GetString("records-height", ("height", stationRecord.Height))}
301+
{(!string.IsNullOrEmpty(stationRecord.SecurityRecord) ? stationRecord.SecurityRecord
302+
: Loc.GetString("criminal-records-console-no-security-record"))}
303+
""";
272304
// WL-Records-End
273305
}
274306

Content.Client/Lobby/UI/HumanoidProfileEditor.xaml.cs

Lines changed: 102 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
using Content.Client.Sprite;
1515
using Content.Client.UserInterface.Systems.Guidebook;
1616
using Content.Shared._WL.Skills; // WL-Skills
17+
using Content.Shared._WL.Records; // WL-Records
1718
using Content.Shared.CCVar;
1819
using Content.Shared.Clothing;
1920
using Content.Shared.Corvax.CCCVars;
@@ -41,7 +42,8 @@
4142
using Robust.Shared.Utility;
4243
using Direction = Robust.Shared.Maths.Direction;
4344
using static Content.Client.Corvax.SponsorOnlyHelpers; // Corvax-Sponsors
44-
using Content.Client.Corvax.TTS; // Corvax-TTS
45+
using Content.Client.Corvax.TTS;
46+
using Content.Client.Lathe.UI; // Corvax-TTS
4547

4648
namespace Content.Client.Lobby.UI
4749
{
@@ -195,6 +197,15 @@ public sealed partial class HumanoidProfileEditor : BoxContainer
195197
private TextEdit? _securityRecordEdit; // WL-Records
196198
private TextEdit? _employmentRecordEdit; // WL-Records
197199

200+
private LineEdit? _generalRecordNameEdit; // WL-Records
201+
private LineEdit? _generalRecordAgeEdit; // WL-Records
202+
private LineEdit? _generalRecordCountryEdit; // WL-Records
203+
204+
private OptionButton? _confederationButton; // WL-Records
205+
206+
207+
private List<ConfederationRecordsPrototype> _confederations = new(); // WL-Recordss
208+
198209
private SingleMarkingPicker _underwearPicker => CUnderwearPicker; // WL-Underwear
199210
private SingleMarkingPicker _undershirtPicker => CUndershirtPicker; // WL-Underwear
200211
private SingleMarkingPicker _socksPicker => CSocksPicker; // WL-Underwear
@@ -743,6 +754,12 @@ public HumanoidProfileEditor(
743754
RefreshFlavorText();
744755

745756
RefreshRecords(); // WL-Records
757+
758+
//_confederationButton.OnItemSelected += args =>
759+
//{
760+
761+
//};
762+
746763
RefreshVoiceTab(); // Corvax-TTS
747764

748765
#region Dummy
@@ -822,9 +839,37 @@ public void RefreshRecords()
822839
_securityRecordEdit = _recordsTab.SecurityRecordInput;
823840
_employmentRecordEdit = _recordsTab.EmploymentRecordInput;
824841

842+
_generalRecordNameEdit = _recordsTab.NameEdit;
843+
_generalRecordAgeEdit = _recordsTab.AgeEdit;
844+
_generalRecordCountryEdit = _recordsTab.CountryEdit;
845+
846+
_confederationButton = _recordsTab.ConfederationButton;
847+
825848
_recordsTab.OnMedicalRecordChanged += OnMedicalRecordChange;
826849
_recordsTab.OnSecurityRecordChanged += OnSecurityRecordChange;
827850
_recordsTab.OnEmploymentRecordChanged += OnEmploymentRecordChange;
851+
852+
_recordsTab.OnGeneralRecordNameChanged += OnGeneralRecordNameChanged;
853+
_recordsTab.OnGeneralRecordAgeChanged += OnGeneralRecordDateOfBirthChanged;
854+
_recordsTab.OnGeneralRecordCountryChanged += OnGeneralRecordCountryChanged;
855+
856+
_recordsTab.OnGeneralRecordConfederationChanged += SetConfederation;
857+
858+
_confederations.AddRange(_prototypeManager.EnumeratePrototypes<ConfederationRecordsPrototype>());
859+
860+
_confederations.Sort((a, b) => string.Compare(a.Name, b.Name, StringComparison.CurrentCultureIgnoreCase));
861+
862+
for (var i = 0; i < _confederations.Count; i++)
863+
{
864+
var name = Loc.GetString(_confederations[i].Name);
865+
866+
_recordsTab.ConfederationButton.AddItem(name, i);
867+
868+
if (_confederations[i].ID == "NoConfederation")
869+
{
870+
_recordsTab.ConfederationButton.SelectId(i);
871+
}
872+
}
828873
}
829874

830875
private void OnMedicalRecordChange(string content)
@@ -853,6 +898,44 @@ private void OnEmploymentRecordChange(string content)
853898
Profile = Profile.WithEmploymentRecord(content);
854899
SetDirty();
855900
}
901+
902+
private void OnGeneralRecordNameChanged(string content)
903+
{
904+
if (Profile is null)
905+
return;
906+
907+
Profile = Profile.WithFullName(content);
908+
SetDirty();
909+
}
910+
private void OnGeneralRecordDateOfBirthChanged(string content)
911+
{
912+
if (Profile is null)
913+
return;
914+
915+
Profile = Profile.WithDateOfBirth(content);
916+
SetDirty();
917+
}
918+
private void OnGeneralRecordCountryChanged(string content)
919+
{
920+
if (Profile is null)
921+
return;
922+
923+
Profile = Profile.WithCountry(content);
924+
SetDirty();
925+
}
926+
private void SetConfederation(OptionButton.ItemSelectedEventArgs args)
927+
{
928+
if (_confederationButton is null)
929+
return;
930+
931+
if (Profile is null)
932+
return;
933+
934+
_confederationButton.SelectId(args.Id);
935+
Profile = Profile.WithConfederation(_confederations[args.Id].ID);
936+
SetDirty();
937+
}
938+
856939
// WL-Records-End
857940
// Corvax-TTS-Start
858941
#region Voice
@@ -1909,6 +1992,24 @@ private void UpdateRecordsEdit()
19091992

19101993
if (_employmentRecordEdit != null)
19111994
_employmentRecordEdit.TextRope = new Rope.Leaf(Profile?.EmploymentRecord ?? "");
1995+
1996+
if (_generalRecordNameEdit != null)
1997+
_generalRecordNameEdit.Text = Profile?.FullName ?? "";
1998+
1999+
if (_generalRecordAgeEdit != null)
2000+
_generalRecordAgeEdit.Text = Profile?.DateOfBirth ?? "";
2001+
2002+
if (_generalRecordCountryEdit != null)
2003+
_generalRecordCountryEdit.Text = Profile?.Country ?? "";
2004+
2005+
if (_confederationButton != null)
2006+
for (var i = 0; i < _confederations.Count; i++)
2007+
{
2008+
if (Profile?.Confederation.Equals(_confederations[i].ID) == true)
2009+
{
2010+
_confederationButton.SelectId(i);
2011+
}
2012+
}
19122013
}
19132014
// WL-Records-End
19142015

Content.Client/StationRecords/GeneralRecord.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<Label Name="Species"/>
99
<Label Name="Gender"/> -->
1010
<Label Text="{Loc 'general-station-record-employment-record'}"/>
11-
<ScrollContainer VerticalExpand="True" MinHeight="300">
11+
<ScrollContainer VerticalExpand="True" MinHeight="300" HScrollEnabled="False">
1212
<BoxContainer Orientation="Vertical" VerticalExpand="True" HorizontalExpand="True">
1313
<RichTextLabel Name="Record"
1414
Margin="5"

Content.Client/StationRecords/GeneralRecord.xaml.cs

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
using Content.Shared.StationRecords;
1+
using Content.Shared._WL.Languages;
2+
using Content.Shared._WL.Records; // WL-Records
23
using Content.Shared.Humanoid.Prototypes;
4+
using Content.Shared.StationRecords;
35
using Robust.Client.AutoGenerated;
46
using Robust.Client.UserInterface;
57
using Robust.Client.UserInterface.XAML;
@@ -22,9 +24,39 @@ public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id, IPro
2224
// Species.Text = Loc.GetString("general-station-record-console-record-species", ("species", record.Species));
2325
// Gender.Text = Loc.GetString("general-station-record-console-record-gender",
2426
// ("gender", record.Gender.ToString()));
25-
Record.Text = !string.IsNullOrEmpty(record.EmploymentRecord)
26-
? record.EmploymentRecord
27-
: Loc.GetString("general-station-console-no-employment-record");
27+
28+
var confederation = string.Empty;
29+
30+
if (prototypeManager.TryIndex<ConfederationRecordsPrototype>(record.Confederation, out var proto))
31+
confederation = Loc.GetString(proto.Name);
32+
else
33+
confederation = Loc.GetString("generic-not-available-shorthand");
34+
35+
string languages = string.Empty;
36+
37+
for (int i = 0; i < record.Languages.Count; i++)
38+
{
39+
languages += Loc.GetString(prototypeManager.Index<LanguagePrototype>(record.Languages[i]).Name);
40+
41+
if (i != record.Languages.Count - 1)
42+
languages += ", ";
43+
else
44+
languages += ".";
45+
}
46+
47+
Record.Text = $"""
48+
{Loc.GetString("records-full-name-edit")} {(!string.IsNullOrEmpty(record.Fullname)
49+
? record.Fullname : record.Name)}
50+
{Loc.GetString("records-date-of-birth-edit")} {(!string.IsNullOrEmpty(record.DateOfBirth)
51+
? record.DateOfBirth : Loc.GetString("generic-not-available-shorthand"))}
52+
{Loc.GetString("records-confederation-edit")} {confederation}
53+
{Loc.GetString("records-country-edit")} {(!string.IsNullOrEmpty(record.Country)
54+
? record.Country : Loc.GetString("generic-not-available-shorthand"))}
55+
{Loc.GetString("records-species")} {Loc.GetString(prototypeManager.Index<SpeciesPrototype>(record.Species).Name)}
56+
{Loc.GetString("records-language")} {languages}
57+
{(!string.IsNullOrEmpty(record.EmploymentRecord) ? record.EmploymentRecord
58+
: Loc.GetString("general-station-console-no-employment-record"))}
59+
""";
2860
// WL-Records-Edit-End
2961
Fingerprint.Text = Loc.GetString("general-station-record-console-record-fingerprint",
3062
("fingerprint", record.Fingerprint ?? Loc.GetString("generic-not-available-shorthand")));

Content.Client/StationRecords/GeneralStationRecordConsoleBoundUserInterface.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Content.Shared.StationRecords;
2+
using Content.Shared._WL.Records;
23
using Robust.Client.UserInterface;
34

45
namespace Content.Client.StationRecords;
@@ -22,6 +23,7 @@ protected override void Open()
2223
_window.OnFiltersChanged += (type, filterValue) =>
2324
SendMessage(new SetStationRecordFilter(type, filterValue));
2425
_window.OnDeleted += id => SendMessage(new DeleteStationRecord(id));
26+
_window.OnPrint += id => SendMessage(new PrintStationRecord(id));
2527
}
2628

2729
protected override void UpdateState(BoundUserInterfaceState state)

Content.Client/StationRecords/GeneralStationRecordConsoleWindow.xaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<DefaultWindow xmlns="https://spacestation14.io"
22
Title="{Loc 'general-station-record-console-window-title'}"
3-
MinSize="750 500">
3+
MinSize="750 520"> <!-- WL-Records -->
44
<BoxContainer Orientation="Vertical">
55
<BoxContainer Margin="5 5 5 10" HorizontalExpand="true" VerticalAlignment="Center">
66
<OptionButton Name="StationRecordsFilterType" MinWidth="200" Margin="0 0 10 0"/>
@@ -17,9 +17,12 @@
1717
<ItemList Name="RecordListing" />
1818
</ScrollContainer>
1919
</BoxContainer>
20-
<BoxContainer Orientation="Vertical" Margin="5">
20+
<BoxContainer Orientation="Vertical" Margin="5" HorizontalExpand="True" VerticalExpand="True"> <!-- WL-Records -->
2121
<Label Name="RecordContainerStatus" Visible="False" Text="{Loc 'general-station-record-console-select-record-info'}"/>
22-
<Control Name="RecordContainer" Visible="False"/>
22+
<Control Name="RecordContainer" Visible="False" HorizontalExpand="True" VerticalExpand="True"/>
23+
<BoxContainer Orientation="Horizontal" Margin="5">
24+
<Button Name="PrintButton" Text="{Loc 'records-print-button'}" MinWidth="200"/> <!-- WL-Records -->
25+
</BoxContainer>
2326
</BoxContainer>
2427
</BoxContainer>
2528
</BoxContainer>

0 commit comments

Comments
 (0)