* base identity hide * ui * Better UI * store data in Mind * disable arrivals an leave announcement * tips updated * Enhance identity recognition and examination feedback Added logic to display remembered character names during examination and improved the process for remembering character names on map initialization. Also updated localization files to include new examination feedback strings. Minor refactoring and bug fixes in identity recognition systems. * Update CP14SharedIdentityRecognitionSystem.cs * fix
62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
namespace Content.Client._CP14.IdentityRecognition;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class CP14RememberNameWindow : DefaultWindow
|
|
{
|
|
public event Action<string>? OnRememberedNameChanged;
|
|
|
|
/// <summary>
|
|
/// Is the user currently entering text into the control?
|
|
/// </summary>
|
|
private bool _focused;
|
|
// TODO LineEdit Make this a bool on the LineEdit control
|
|
|
|
private string _label = string.Empty;
|
|
|
|
public CP14RememberNameWindow()
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
|
|
LabelLineEdit.OnTextChanged += e =>
|
|
{
|
|
_label = e.Text;
|
|
OnRememberedNameChanged?.Invoke(_label);
|
|
};
|
|
|
|
LabelLineEdit.OnFocusEnter += _ => _focused = true;
|
|
LabelLineEdit.OnFocusExit += _ =>
|
|
{
|
|
_focused = false;
|
|
LabelLineEdit.Text = _label;
|
|
};
|
|
}
|
|
|
|
protected override void Opened()
|
|
{
|
|
base.Opened();
|
|
|
|
// Give the editor keyboard focus, since that's the only
|
|
// thing the user will want to be doing with this UI
|
|
LabelLineEdit.GrabKeyboardFocus();
|
|
}
|
|
|
|
public void SetCurrentLabel(string label)
|
|
{
|
|
if (label == _label)
|
|
return;
|
|
|
|
_label = label;
|
|
if (!_focused)
|
|
LabelLineEdit.Text = label;
|
|
}
|
|
|
|
public void SetMaxLabelLength(int maxLength)
|
|
{
|
|
LabelLineEdit.IsValid = s => s.Length <= maxLength;
|
|
}
|
|
}
|