CatStation/Content.Client/Lobby/UI/HumanoidProfileEditor.BasicInfo.cs
Vladislav Suchkov 3a0aad1ff5
Add randomizer lock buttons to character editor screen (#44363)
* init

* tweak lightness

* add randomize helpers, refactor to use

* wip

* wip

* wip

* wip

* docs, cleanup

* review partial

* review wip (doesnt build)

* wip (now working, but found a bug)

* touchups

* less ambiguity

* Tweak the UI, make LockButton a BoxContainer

---------

Co-authored-by: AJCM-git <ajcm_mail@disroot.org>
2026-07-02 19:56:34 -04:00

35 lines
810 B
C#

using Content.Shared.Preferences;
namespace Content.Client.Lobby.UI;
public sealed partial class HumanoidProfileEditor
{
private void SetName(string newName)
{
Profile = Profile?.WithName(newName);
SetDirty();
if (!IsDirty)
return;
SpriteView.SetName(newName);
}
private void UpdateNameEdit()
{
NameEdit.Text = Profile?.Name ?? "";
}
/// <summary>
/// Randomize values selectively while respecting locked values.
/// </summary>
private void RandomizeProfile()
{
Profile = Profile == null
? HumanoidCharacterProfile.Random()
: HumanoidCharacterProfile.Random(RandomizeLockButton.RandomizeCfg, Profile!);
SetProfile(Profile, CharacterSlot);
SetDirty();
}
}