fix species name in station records (#36217)
* fix species name in station records * the hellish commit * Update GeneralStationRecordConsoleWindow.xaml.cs * fix --------- Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
|||||||
using Content.Shared.StationRecords;
|
using Content.Shared.StationRecords;
|
||||||
|
using Content.Shared.Humanoid.Prototypes;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.Enums;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.StationRecords;
|
namespace Content.Client.StationRecords;
|
||||||
|
|
||||||
@@ -10,14 +11,15 @@ namespace Content.Client.StationRecords;
|
|||||||
public sealed partial class GeneralRecord : Control
|
public sealed partial class GeneralRecord : Control
|
||||||
{
|
{
|
||||||
public Action<uint>? OnDeletePressed;
|
public Action<uint>? OnDeletePressed;
|
||||||
public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id)
|
public GeneralRecord(GeneralStationRecord record, bool canDelete, uint? id, IPrototypeManager prototypeManager)
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
RecordName.Text = record.Name;
|
RecordName.Text = record.Name;
|
||||||
Age.Text = Loc.GetString("general-station-record-console-record-age", ("age", record.Age.ToString()));
|
Age.Text = Loc.GetString("general-station-record-console-record-age", ("age", record.Age.ToString()));
|
||||||
Title.Text = Loc.GetString("general-station-record-console-record-title",
|
Title.Text = Loc.GetString("general-station-record-console-record-title",
|
||||||
("job", Loc.GetString(record.JobTitle)));
|
("job", Loc.GetString(record.JobTitle)));
|
||||||
Species.Text = Loc.GetString("general-station-record-console-record-species", ("species", record.Species));
|
var species = Loc.GetString(prototypeManager.Index<SpeciesPrototype>(record.Species).Name);
|
||||||
|
Species.Text = Loc.GetString("general-station-record-console-record-species", ("species", species));
|
||||||
Gender.Text = Loc.GetString("general-station-record-console-record-gender",
|
Gender.Text = Loc.GetString("general-station-record-console-record-gender",
|
||||||
("gender", record.Gender.ToString()));
|
("gender", record.Gender.ToString()));
|
||||||
Fingerprint.Text = Loc.GetString("general-station-record-console-record-fingerprint",
|
Fingerprint.Text = Loc.GetString("general-station-record-console-record-fingerprint",
|
||||||
@@ -25,7 +27,7 @@ public sealed partial class GeneralRecord : Control
|
|||||||
Dna.Text = Loc.GetString("general-station-record-console-record-dna",
|
Dna.Text = Loc.GetString("general-station-record-console-record-dna",
|
||||||
("dna", record.DNA ?? Loc.GetString("generic-not-available-shorthand")));
|
("dna", record.DNA ?? Loc.GetString("generic-not-available-shorthand")));
|
||||||
|
|
||||||
if (canDelete && id != null )
|
if (canDelete && id != null)
|
||||||
{
|
{
|
||||||
DeleteButton.Visible = true;
|
DeleteButton.Visible = true;
|
||||||
DeleteButton.OnPressed += _ => OnDeletePressed?.Invoke(id.Value);
|
DeleteButton.OnPressed += _ => OnDeletePressed?.Invoke(id.Value);
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ using Content.Shared.StationRecords;
|
|||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.StationRecords;
|
namespace Content.Client.StationRecords;
|
||||||
|
|
||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
|
public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||||
|
|
||||||
public Action<uint?>? OnKeySelected;
|
public Action<uint?>? OnKeySelected;
|
||||||
|
|
||||||
public Action<StationRecordFilterType, string>? OnFiltersChanged;
|
public Action<StationRecordFilterType, string>? OnFiltersChanged;
|
||||||
@@ -20,6 +23,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
|
|||||||
public GeneralStationRecordConsoleWindow()
|
public GeneralStationRecordConsoleWindow()
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
|
IoCManager.InjectDependencies(this);
|
||||||
|
|
||||||
_currentFilterType = StationRecordFilterType.Name;
|
_currentFilterType = StationRecordFilterType.Name;
|
||||||
|
|
||||||
@@ -44,7 +48,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
|
|||||||
|
|
||||||
StationRecordsFilterType.OnItemSelected += eventArgs =>
|
StationRecordsFilterType.OnItemSelected += eventArgs =>
|
||||||
{
|
{
|
||||||
var type = (StationRecordFilterType) eventArgs.Id;
|
var type = (StationRecordFilterType)eventArgs.Id;
|
||||||
|
|
||||||
if (_currentFilterType != type)
|
if (_currentFilterType != type)
|
||||||
{
|
{
|
||||||
@@ -139,7 +143,7 @@ public sealed partial class GeneralStationRecordConsoleWindow : DefaultWindow
|
|||||||
private void PopulateRecordContainer(GeneralStationRecord record, bool enableDelete, uint? id)
|
private void PopulateRecordContainer(GeneralStationRecord record, bool enableDelete, uint? id)
|
||||||
{
|
{
|
||||||
RecordContainer.RemoveAllChildren();
|
RecordContainer.RemoveAllChildren();
|
||||||
var newRecord = new GeneralRecord(record, enableDelete, id);
|
var newRecord = new GeneralRecord(record, enableDelete, id, _prototypeManager);
|
||||||
newRecord.OnDeletePressed = OnDeleted;
|
newRecord.OnDeletePressed = OnDeleted;
|
||||||
|
|
||||||
RecordContainer.AddChild(newRecord);
|
RecordContainer.AddChild(newRecord);
|
||||||
|
|||||||
Reference in New Issue
Block a user