mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-08 23:37:25 +00:00
* initial visual nubody * oops overlay * im so pheeming rn * conversion... * tests * comeback of the underwear * oops eyes * blabbl * zeds * yaml linted * search and visible count constraints * reordering * preserve previously selected markings colors * fix test * some ui niceties * ordering * make DB changes backwards-compatible/downgrade-friendly * fix things again * fix migration * vulpkanin markings limit increase * wrapping * code cleanup and more code cleanup and more code cleanup and more code cleanup and * fix slop ports * better sampling API * make filter work + use the method i made for its intended purpose * fix test fails real quick * magic mirror cleanup, remove TODO * don't 0-init the organ profile data * remove deltastates --------- Co-authored-by: Princess Cheeseballs <66055347+Pronana@users.noreply.github.com> # Conflicts: # Content.Server/Humanoid/Components/RandomHumanoidAppearanceComponent.cs # Content.Server/Humanoid/Systems/RandomHumanoidAppearanceSystem.cs # Conflicts: # Resources/Prototypes/Species/diona.yml # Conflicts: # Content.Server/Zombies/ZombieSystem.Transform.cs
93 lines
2.7 KiB
C#
93 lines
2.7 KiB
C#
using System.Linq;
|
|
using Content.Client.Humanoid;
|
|
using Content.Shared.Clothing;
|
|
using Content.Shared.Humanoid;
|
|
using Content.Shared.Humanoid.Prototypes;
|
|
using Content.Shared.Preferences;
|
|
using Content.Shared.Preferences.Loadouts;
|
|
using Content.Shared.Roles;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Lobby.UI;
|
|
|
|
/// <summary>
|
|
/// Holds character data on the side of the setup GUI.
|
|
/// </summary>
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class CharacterPickerButton : ContainerButton
|
|
{
|
|
private IEntityManager _entManager;
|
|
|
|
private EntityUid _previewDummy;
|
|
|
|
/// <summary>
|
|
/// Invoked if we should delete the attached character
|
|
/// </summary>
|
|
public event Action? OnDeletePressed;
|
|
|
|
public CharacterPickerButton(
|
|
IEntityManager entityManager,
|
|
IPrototypeManager prototypeManager,
|
|
ButtonGroup group,
|
|
ICharacterProfile profile,
|
|
bool isSelected)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
_entManager = entityManager;
|
|
AddStyleClass(StyleClassButton);
|
|
ToggleMode = true;
|
|
Group = group;
|
|
var description = profile.Name;
|
|
|
|
if (profile is not HumanoidCharacterProfile humanoid)
|
|
{
|
|
_previewDummy = entityManager.SpawnEntity(prototypeManager.Index<SpeciesPrototype>(HumanoidCharacterProfile.DefaultSpecies).DollPrototype, MapCoordinates.Nullspace);
|
|
}
|
|
else
|
|
{
|
|
_previewDummy = UserInterfaceManager.GetUIController<LobbyUIController>()
|
|
.LoadProfileEntity(humanoid, null, true);
|
|
|
|
var highPriorityJob = humanoid.JobPriorities.SingleOrDefault(p => p.Value == JobPriority.High).Key;
|
|
if (highPriorityJob != default)
|
|
{
|
|
var jobName = prototypeManager.Index(highPriorityJob).LocalizedName;
|
|
description = $"{description}\n{jobName}";
|
|
}
|
|
}
|
|
|
|
Pressed = isSelected;
|
|
DeleteButton.Visible = !isSelected;
|
|
|
|
View.SetEntity(_previewDummy);
|
|
DescriptionLabel.Text = description;
|
|
|
|
ConfirmDeleteButton.OnPressed += _ =>
|
|
{
|
|
Parent?.RemoveChild(this);
|
|
Parent?.RemoveChild(ConfirmDeleteButton);
|
|
OnDeletePressed?.Invoke();
|
|
};
|
|
|
|
DeleteButton.OnPressed += _ =>
|
|
{
|
|
DeleteButton.Visible = false;
|
|
ConfirmDeleteButton.Visible = true;
|
|
};
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
if (!disposing)
|
|
return;
|
|
|
|
_entManager.DeleteEntity(_previewDummy);
|
|
_previewDummy = default;
|
|
}
|
|
}
|