Add loadout names (#31303)
* Add loadout names Did it for AI, breaking change for pgsql + migrations in general. Nothing atm uses it. * the box * Spawning cherry pick * Fix nit * revert * Final cleanup * Real * Name UI fix * Migrations * a * Review * Re-run migrations --------- Co-authored-by: Pieter-Jan Briers <pieterjan.briers+git@gmail.com>
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System.Numerics;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Shared.Dataset;
|
||||
using Content.Shared.Preferences;
|
||||
using Content.Shared.Preferences.Loadouts;
|
||||
using Content.Shared.Random.Helpers;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Player;
|
||||
@@ -13,6 +15,7 @@ namespace Content.Client.Lobby.UI.Loadouts;
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class LoadoutWindow : FancyWindow
|
||||
{
|
||||
public event Action<string>? OnNameChanged;
|
||||
public event Action<ProtoId<LoadoutGroupPrototype>, ProtoId<LoadoutPrototype>>? OnLoadoutPressed;
|
||||
public event Action<ProtoId<LoadoutGroupPrototype>, ProtoId<LoadoutPrototype>>? OnLoadoutUnpressed;
|
||||
|
||||
@@ -25,6 +28,23 @@ public sealed partial class LoadoutWindow : FancyWindow
|
||||
RobustXamlLoader.Load(this);
|
||||
Profile = profile;
|
||||
var protoManager = collection.Resolve<IPrototypeManager>();
|
||||
RoleNameEdit.IsValid = text => text.Length <= HumanoidCharacterProfile.MaxLoadoutNameLength;
|
||||
|
||||
// Hide if we can't edit the name.
|
||||
if (!proto.CanCustomizeName)
|
||||
{
|
||||
RoleNameBox.Visible = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
var name = loadout.EntityName;
|
||||
|
||||
RoleNameEdit.ToolTip = Loc.GetString(
|
||||
"loadout-name-edit-tooltip",
|
||||
("max", HumanoidCharacterProfile.MaxLoadoutNameLength));
|
||||
RoleNameEdit.Text = name ?? string.Empty;
|
||||
RoleNameEdit.OnTextChanged += args => OnNameChanged?.Invoke(args.Text);
|
||||
}
|
||||
|
||||
// Hide if no groups
|
||||
if (proto.Groups.Count == 0)
|
||||
|
||||
Reference in New Issue
Block a user