From 1856d6aaa509a6d487f272e41b6426bb803a7199 Mon Sep 17 00:00:00 2001
From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Date: Wed, 9 Aug 2023 16:26:33 +1000
Subject: [PATCH] Add clothing toggle to character editor (#18903)
---
.../UI/HumanoidProfileEditor.Random.cs | 5 -
.../Preferences/UI/HumanoidProfileEditor.xaml | 115 ++++++++----------
.../UI/HumanoidProfileEditor.xaml.cs | 20 ++-
.../ui/humanoid-profile-editor.ftl | 1 +
4 files changed, 69 insertions(+), 72 deletions(-)
diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.Random.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.Random.cs
index 732f674ec6..c9e184dfc2 100644
--- a/Content.Client/Preferences/UI/HumanoidProfileEditor.Random.cs
+++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.Random.cs
@@ -1,15 +1,10 @@
-using Content.Shared.Dataset;
-using Content.Shared.Humanoid;
using Content.Shared.Preferences;
-using Content.Shared.Random.Helpers;
using Robust.Shared.Prototypes;
-using Robust.Shared.Random;
namespace Content.Client.Preferences.UI
{
public sealed partial class HumanoidProfileEditor
{
- private readonly IRobustRandom _random;
private readonly IPrototypeManager _prototypeManager;
private void RandomizeEverything()
diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
index 92a17225c1..c1b1b40d71 100644
--- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
+++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml
@@ -52,75 +52,66 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
+
+
+
+
diff --git a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
index eaae35aa8a..371b34c89c 100644
--- a/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
+++ b/Content.Client/Preferences/UI/HumanoidProfileEditor.xaml.cs
@@ -11,6 +11,7 @@ using Content.Shared.GameTicking;
using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes;
+using Content.Shared.Inventory;
using Content.Shared.Preferences;
using Content.Shared.Roles;
using Content.Shared.StatusIcon;
@@ -112,7 +113,6 @@ namespace Content.Client.Preferences.UI
IEntityManager entityManager, IConfigurationManager configurationManager)
{
RobustXamlLoader.Load(this);
- _random = IoCManager.Resolve();
_prototypeManager = prototypeManager;
_entMan = entityManager;
_preferencesManager = preferencesManager;
@@ -138,6 +138,8 @@ namespace Content.Client.Preferences.UI
_tabContainer.SetTabTitle(0, Loc.GetString("humanoid-profile-editor-appearance-tab"));
+ ShowClothes.OnPressed += ToggleClothes;
+
#region Sex
_sexButton.OnItemSelected += args =>
@@ -519,6 +521,11 @@ namespace Content.Client.Preferences.UI
IsDirty = false;
}
+ private void ToggleClothes(BaseButton.ButtonEventArgs obj)
+ {
+ RebuildSpriteView();
+ }
+
private void UpdateRoleRequirements()
{
_jobList.DisposeAllChildren();
@@ -736,7 +743,7 @@ namespace Content.Client.Preferences.UI
}
else
{
- _previewSprite.Sprite = sprite;
+ _previewSprite.SetEntity(_previewDummy.Value);
}
if (_previewSpriteSide == null)
@@ -753,7 +760,7 @@ namespace Content.Client.Preferences.UI
}
else
{
- _previewSpriteSide.Sprite = sprite;
+ _previewSpriteSide.SetEntity(_previewDummy.Value);
}
_needUpdatePreview = true;
}
@@ -1122,8 +1129,11 @@ namespace Content.Client.Preferences.UI
if (Profile is null)
return;
- EntitySystem.Get().LoadProfile(_previewDummy!.Value, Profile);
- LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy!.Value, Profile);
+ var humanoid = _entMan.System();
+ humanoid.LoadProfile(_previewDummy!.Value, Profile);
+
+ if (ShowClothes.Pressed)
+ LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy!.Value, Profile);
}
public void UpdateControls()
diff --git a/Resources/Locale/en-US/preferences/ui/humanoid-profile-editor.ftl b/Resources/Locale/en-US/preferences/ui/humanoid-profile-editor.ftl
index 4b7dccd2bc..5f11d1d5d7 100644
--- a/Resources/Locale/en-US/preferences/ui/humanoid-profile-editor.ftl
+++ b/Resources/Locale/en-US/preferences/ui/humanoid-profile-editor.ftl
@@ -2,6 +2,7 @@ humanoid-profile-editor-randomize-everything-button = Randomize everything
humanoid-profile-editor-name-label = Name:
humanoid-profile-editor-name-random-button = Randomize
humanoid-profile-editor-appearance-tab = Appearance
+humanoid-profile-editor-clothing = Show clothing
humanoid-profile-editor-sex-label = Sex:
humanoid-profile-editor-sex-male-text = Male
humanoid-profile-editor-sex-female-text = Female