Add clothing toggle to character editor (#18903)

This commit is contained in:
metalgearsloth
2023-08-09 16:26:33 +10:00
committed by GitHub
parent c12fd36a88
commit 1856d6aaa5
4 changed files with 69 additions and 72 deletions

View File

@@ -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<IRobustRandom>();
_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<HumanoidAppearanceSystem>().LoadProfile(_previewDummy!.Value, Profile);
LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy!.Value, Profile);
var humanoid = _entMan.System<HumanoidAppearanceSystem>();
humanoid.LoadProfile(_previewDummy!.Value, Profile);
if (ShowClothes.Pressed)
LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy!.Value, Profile);
}
public void UpdateControls()