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.Preferences;
using Content.Shared.Random.Helpers;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Random;
namespace Content.Client.Preferences.UI namespace Content.Client.Preferences.UI
{ {
public sealed partial class HumanoidProfileEditor public sealed partial class HumanoidProfileEditor
{ {
private readonly IRobustRandom _random;
private readonly IPrototypeManager _prototypeManager; private readonly IPrototypeManager _prototypeManager;
private void RandomizeEverything() private void RandomizeEverything()

View File

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

View File

@@ -11,6 +11,7 @@ using Content.Shared.GameTicking;
using Content.Shared.Humanoid; using Content.Shared.Humanoid;
using Content.Shared.Humanoid.Markings; using Content.Shared.Humanoid.Markings;
using Content.Shared.Humanoid.Prototypes; using Content.Shared.Humanoid.Prototypes;
using Content.Shared.Inventory;
using Content.Shared.Preferences; using Content.Shared.Preferences;
using Content.Shared.Roles; using Content.Shared.Roles;
using Content.Shared.StatusIcon; using Content.Shared.StatusIcon;
@@ -112,7 +113,6 @@ namespace Content.Client.Preferences.UI
IEntityManager entityManager, IConfigurationManager configurationManager) IEntityManager entityManager, IConfigurationManager configurationManager)
{ {
RobustXamlLoader.Load(this); RobustXamlLoader.Load(this);
_random = IoCManager.Resolve<IRobustRandom>();
_prototypeManager = prototypeManager; _prototypeManager = prototypeManager;
_entMan = entityManager; _entMan = entityManager;
_preferencesManager = preferencesManager; _preferencesManager = preferencesManager;
@@ -138,6 +138,8 @@ namespace Content.Client.Preferences.UI
_tabContainer.SetTabTitle(0, Loc.GetString("humanoid-profile-editor-appearance-tab")); _tabContainer.SetTabTitle(0, Loc.GetString("humanoid-profile-editor-appearance-tab"));
ShowClothes.OnPressed += ToggleClothes;
#region Sex #region Sex
_sexButton.OnItemSelected += args => _sexButton.OnItemSelected += args =>
@@ -519,6 +521,11 @@ namespace Content.Client.Preferences.UI
IsDirty = false; IsDirty = false;
} }
private void ToggleClothes(BaseButton.ButtonEventArgs obj)
{
RebuildSpriteView();
}
private void UpdateRoleRequirements() private void UpdateRoleRequirements()
{ {
_jobList.DisposeAllChildren(); _jobList.DisposeAllChildren();
@@ -736,7 +743,7 @@ namespace Content.Client.Preferences.UI
} }
else else
{ {
_previewSprite.Sprite = sprite; _previewSprite.SetEntity(_previewDummy.Value);
} }
if (_previewSpriteSide == null) if (_previewSpriteSide == null)
@@ -753,7 +760,7 @@ namespace Content.Client.Preferences.UI
} }
else else
{ {
_previewSpriteSide.Sprite = sprite; _previewSpriteSide.SetEntity(_previewDummy.Value);
} }
_needUpdatePreview = true; _needUpdatePreview = true;
} }
@@ -1122,7 +1129,10 @@ namespace Content.Client.Preferences.UI
if (Profile is null) if (Profile is null)
return; return;
EntitySystem.Get<HumanoidAppearanceSystem>().LoadProfile(_previewDummy!.Value, Profile); var humanoid = _entMan.System<HumanoidAppearanceSystem>();
humanoid.LoadProfile(_previewDummy!.Value, Profile);
if (ShowClothes.Pressed)
LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy!.Value, Profile); LobbyCharacterPreviewPanel.GiveDummyJobClothes(_previewDummy!.Value, Profile);
} }

View File

@@ -2,6 +2,7 @@ humanoid-profile-editor-randomize-everything-button = Randomize everything
humanoid-profile-editor-name-label = Name: humanoid-profile-editor-name-label = Name:
humanoid-profile-editor-name-random-button = Randomize humanoid-profile-editor-name-random-button = Randomize
humanoid-profile-editor-appearance-tab = Appearance humanoid-profile-editor-appearance-tab = Appearance
humanoid-profile-editor-clothing = Show clothing
humanoid-profile-editor-sex-label = Sex: humanoid-profile-editor-sex-label = Sex:
humanoid-profile-editor-sex-male-text = Male humanoid-profile-editor-sex-male-text = Male
humanoid-profile-editor-sex-female-text = Female humanoid-profile-editor-sex-female-text = Female