Station records patches (#10636)

This commit is contained in:
Flipp Syder
2022-08-16 21:03:23 -07:00
committed by GitHub
parent 04b943f2aa
commit 1b50928d50
6 changed files with 72 additions and 23 deletions

View File

@@ -59,7 +59,7 @@ namespace Content.Client.Access.UI
_window?.UpdateState(castState);
}
public void SubmitData(string newFullName, string newJobTitle, List<string> newAccessList)
public void SubmitData(string newFullName, string newJobTitle, List<string> newAccessList, string newJobPrototype)
{
if (newFullName.Length > MaxFullNameLength)
newFullName = newFullName[..MaxFullNameLength];
@@ -70,7 +70,8 @@ namespace Content.Client.Access.UI
SendMessage(new WriteToTargetIdMessage(
newFullName,
newJobTitle,
newAccessList));
newAccessList,
newJobPrototype));
}
}
}

View File

@@ -26,8 +26,10 @@ namespace Content.Client.Access.UI
private string? _lastFullName;
private string? _lastJobTitle;
private string? _lastJobProto;
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager, List<string> accessLevels)
public IdCardConsoleWindow(IdCardConsoleBoundUserInterface owner, IPrototypeManager prototypeManager,
List<string> accessLevels)
{
RobustXamlLoader.Load(this);
IoCManager.InjectDependencies(this);
@@ -101,6 +103,7 @@ namespace Content.Client.Access.UI
}
JobTitleLineEdit.Text = Loc.GetString(job.Name);
args.Button.SelectId(args.Id);
ClearAllAccess();
@@ -181,17 +184,29 @@ namespace Content.Client.Access.UI
}
}
var jobIndex = _jobPrototypeIds.IndexOf(state.TargetIdJobPrototype);
if (jobIndex >= 0)
{
JobPresetOptionButton.SelectId(jobIndex);
}
_lastFullName = state.TargetIdFullName;
_lastJobTitle = state.TargetIdJobTitle;
_lastJobProto = state.TargetIdJobPrototype;
}
private void SubmitData()
{
// Don't send this if it isn't dirty.
var jobProtoDirty = _lastJobProto != null &&
_jobPrototypeIds[JobPresetOptionButton.SelectedId] != _lastJobProto;
_owner.SubmitData(
FullNameLineEdit.Text,
JobTitleLineEdit.Text,
// Iterate over the buttons dictionary, filter by `Pressed`, only get key from the key/value pair
_accessButtons.Where(x => x.Value.Pressed).Select(x => x.Key).ToList());
_accessButtons.Where(x => x.Value.Pressed).Select(x => x.Key).ToList(),
jobProtoDirty ? _jobPrototypeIds[JobPresetOptionButton.SelectedId] : string.Empty);
}
}
}

View File

@@ -131,11 +131,11 @@ public sealed partial class CrewManifestUi : DefaultWindow
foreach (var entry in entries)
{
var name = new Label()
var name = new RichTextLabel()
{
HorizontalExpand = true,
Text = entry.Name
};
name.SetMessage(entry.Name);
var titleContainer = new BoxContainer()
{
@@ -143,10 +143,8 @@ public sealed partial class CrewManifestUi : DefaultWindow
HorizontalExpand = true
};
var title = new Label()
{
Text = Loc.GetString(entry.JobTitle)
};
var title = new RichTextLabel();
title.SetMessage(Loc.GetString(entry.JobTitle));
if (rsi != null)