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

@@ -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()

View File

@@ -52,75 +52,66 @@
<ScrollContainer VerticalExpand="True">
<!-- appearanceList -->
<BoxContainer Orientation="Vertical">
<!-- SexAndAgeRow -->
<BoxContainer Orientation="Horizontal" SeparationOverride="10">
<BoxContainer Margin="10" Orientation="Vertical" HorizontalExpand="True">
<!-- Show clothing -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-clothing'}" />
<Control HorizontalExpand="True"/>
<Button Name="ShowClothes" Pressed="True" ToggleMode="True" Text="{Loc 'Show'}" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Clothing -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-clothing-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CClothingButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Backpack -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-backpack-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CBackpackButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Sex -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-sex-label'}" />
<OptionButton Name="CSexButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-sex-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CSexButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Pronouns -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-pronouns-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CPronounsButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Age -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-age-label'}" />
<LineEdit Name="CAgeEdit" MinSize="40 0" />
</BoxContainer>
</prefUi:HighlightedContainer>
<!-- Gender -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-pronouns-label'}" />
<OptionButton Name="CPronounsButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
</BoxContainer>
<BoxContainer Orientation="Horizontal" SeparationOverride="10">
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-age-label'}" />
<Control HorizontalExpand="True"/>
<LineEdit Name="CAgeEdit" MinSize="40 0" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Species -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-species-label'}" />
<OptionButton Name="CSpeciesButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-species-label'}" />
<Control HorizontalExpand="True"/>
<OptionButton Name="CSpeciesButton" HorizontalAlignment="Right" />
</BoxContainer>
</BoxContainer>
<!-- Skin -->
<prefUi:HighlightedContainer>
<BoxContainer HorizontalExpand="True" Orientation="Vertical">
<Label Text="{Loc 'humanoid-profile-editor-skin-color-label'}" />
<Slider HorizontalExpand="True" Name="CSkin" MinValue="0" MaxValue="100" Value="20" />
<BoxContainer Name="CRgbSkinColorContainer" Visible="False" Orientation="Vertical" HorizontalExpand="True"></BoxContainer>
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer Margin="10" HorizontalExpand="True" Orientation="Vertical">
<Label Text="{Loc 'humanoid-profile-editor-skin-color-label'}" />
<Slider HorizontalExpand="True" Name="CSkin" MinValue="0" MaxValue="100" Value="20" />
<BoxContainer Name="CRgbSkinColorContainer" Visible="False" Orientation="Vertical" HorizontalExpand="True"></BoxContainer>
</BoxContainer>
<!-- Hair -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<humanoid:SingleMarkingPicker Name="CHairStylePicker" Category="Hair" />
<humanoid:SingleMarkingPicker Name="CFacialHairPicker" Category="FacialHair" />
</BoxContainer>
</prefUi:HighlightedContainer>
<!-- Clothing -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-clothing-label'}" />
<OptionButton Name="CClothingButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
<!-- Backpack -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-backpack-label'}" />
<OptionButton Name="CBackpackButton" />
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer Margin="10" Orientation="Horizontal">
<humanoid:SingleMarkingPicker Name="CHairStylePicker" Category="Hair" />
<humanoid:SingleMarkingPicker Name="CFacialHairPicker" Category="FacialHair" />
</BoxContainer>
<!-- Eyes -->
<prefUi:HighlightedContainer>
<BoxContainer Orientation="Vertical">
<Label Text="{Loc 'humanoid-profile-editor-eyes-label'}" />
<humanoid:EyeColorPicker Name="CEyeColorPicker" />
</BoxContainer>
</prefUi:HighlightedContainer>
<BoxContainer Margin="10" Orientation="Vertical">
<Label Text="{Loc 'humanoid-profile-editor-eyes-label'}" />
<humanoid:EyeColorPicker Name="CEyeColorPicker" />
</BoxContainer>
</BoxContainer>
</ScrollContainer>
</BoxContainer>

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()

View File

@@ -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