[Feat] Тонкие спрайты снова в строю (#102)

* Revert "Hair Overhaul (#19298)"

This reverts commit 9491f322de.

# Conflicts:
#	Resources/Textures/Mobs/Customization/human_hair.rsi/a.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/afro.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/afro2.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/bigafro.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/cornrows2.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/emofringe.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/keanu.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/long.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/long2.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/long3.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/meta.json
#	Resources/Textures/Mobs/Customization/human_hair.rsi/modern.png
#	Resources/Textures/Mobs/Customization/human_hair.rsi/quiff.png

* add: возврат системы тонкоспрайтов

* fix: небольшие фиксы после реверта причесок

* add: старые текстуры для slim бодитайпа

* fix: фикс причесок после апстрима
This commit is contained in:
Remuchi
2024-02-24 17:06:32 +07:00
committed by GitHub
parent ac2d162c53
commit 3515e87f74
850 changed files with 6170 additions and 675 deletions

View File

@@ -75,6 +75,12 @@
<Control HorizontalExpand="True"/>
<OptionButton Name="CSpeciesButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Body Type -->
<BoxContainer Orientation="Horizontal">
<Label Text="{Loc 'humanoid-profile-editor-body-type-label'}"/>
<Control HorizontalExpand="True"/>
<OptionButton Name="CBodyTypesButton" HorizontalAlignment="Right" />
</BoxContainer>
<!-- Age -->
<BoxContainer HorizontalExpand="True">
<Label Text="{Loc 'humanoid-profile-editor-age-label'}" />

View File

@@ -14,13 +14,11 @@ 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;
using Content.Shared.Traits;
using Robust.Client.AutoGenerated;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -29,10 +27,8 @@ using Robust.Client.UserInterface.XAML;
using Robust.Client.Utility;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Log;
using Robust.Shared.Map;
using Robust.Shared.Prototypes;
using Robust.Shared.Random;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BoxContainer;
@@ -44,7 +40,7 @@ namespace Content.Client.Preferences.UI
{
public HighlightedContainer()
{
PanelOverride = new StyleBoxFlat()
PanelOverride = new StyleBoxFlat
{
BackgroundColor = new Color(25, 25, 25),
ContentMarginTopOverride = 10,
@@ -110,6 +106,7 @@ namespace Content.Client.Preferences.UI
private readonly List<SpeciesPrototype> _speciesList;
private readonly List<AntagPreferenceSelector> _antagPreferences;
private readonly List<TraitPreferenceSelector> _traitPreferences;
private List<BodyTypePrototype> _bodyTypesList = new();
private SpriteView _previewSpriteView => CSpriteView;
private Button _previewRotateLeftButton => CSpriteRotateLeft;
@@ -177,6 +174,14 @@ namespace Content.Client.Preferences.UI
#endregion Sex
#region Body Type
CBodyTypesButton.OnItemSelected += OnBodyTypeSelected;
UpdateBodyTypes();
#endregion Body Type
#region Age
_ageEdit.OnTextChanged += args =>
@@ -845,6 +850,7 @@ namespace Content.Client.Preferences.UI
CMarkings.SetSpecies(newSpecies); // Repopulate the markings tab as well.
UpdateSexControls(); // update sex for new species
RebuildSpriteView(); // they might have different inv so we need a new dummy
UpdateBodyTypes();
IsDirty = true;
_needUpdatePreview = true;
}
@@ -903,6 +909,38 @@ namespace Content.Client.Preferences.UI
}
}
private void OnBodyTypeSelected(OptionButton.ItemSelectedEventArgs args)
{
args.Button.SelectId(args.Id);
SetBodyType(_bodyTypesList[args.Id].ID);
}
private void UpdateBodyTypes()
{
if (Profile is null)
return;
CBodyTypesButton.Clear();
var species = _prototypeManager.Index<SpeciesPrototype>(Profile.Species);
var sex = Profile.Sex;
_bodyTypesList = EntitySystem.Get<HumanoidAppearanceSystem>().GetValidBodyTypes(species, sex);
for (var i = 0; i < _bodyTypesList.Count; i++)
{
CBodyTypesButton.AddItem(Loc.GetString(_bodyTypesList[i].Name), i);
}
// If current body type is not valid.
if (!_bodyTypesList.Select(proto => proto.ID).Contains(Profile.BodyType))
{
// Then replace it with a first valid body type.
SetBodyType(_bodyTypesList.First().ID);
}
CBodyTypesButton.Select(_bodyTypesList.FindIndex(x => x.ID == Profile.BodyType));
IsDirty = true;
}
private bool IsDirty
{
get => _isDirty;
@@ -1025,7 +1063,7 @@ namespace Content.Client.Preferences.UI
}
CMarkings.SetData(Profile.Appearance.Markings, Profile.Species,
Profile.Sex, Profile.Appearance.SkinColor, Profile.Appearance.EyeColor
Profile.Sex, Profile.BodyType, Profile.Appearance.SkinColor, Profile.Appearance.EyeColor
);
}
@@ -1090,13 +1128,13 @@ namespace Content.Client.Preferences.UI
var hairMarking = Profile.Appearance.HairStyleId switch
{
HairStyles.DefaultHairStyle => new List<Marking>(),
_ => new() { new(Profile.Appearance.HairStyleId, new List<Color>() { Profile.Appearance.HairColor }) },
_ => new() { new(Profile.Appearance.HairStyleId, new List<Color> { Profile.Appearance.HairColor }) },
};
var facialHairMarking = Profile.Appearance.FacialHairStyleId switch
{
HairStyles.DefaultFacialHairStyle => new List<Marking>(),
_ => new() { new(Profile.Appearance.FacialHairStyleId, new List<Color>() { Profile.Appearance.FacialHairColor }) },
_ => new() { new(Profile.Appearance.FacialHairStyleId, new List<Color> { Profile.Appearance.FacialHairColor }) },
};
_hairPicker.UpdateData(
@@ -1124,7 +1162,7 @@ namespace Content.Client.Preferences.UI
{
if (_markingManager.CanBeApplied(Profile.Species, Profile.Sex, hairProto, _prototypeManager))
{
if (_markingManager.MustMatchSkin(Profile.Species, HumanoidVisualLayers.Hair, out var _, _prototypeManager))
if (_markingManager.MustMatchSkin(Profile.BodyType, HumanoidVisualLayers.Hair, out _, _prototypeManager))
{
hairColor = Profile.Appearance.SkinColor;
}
@@ -1136,7 +1174,7 @@ namespace Content.Client.Preferences.UI
}
if (hairColor != null)
{
CMarkings.HairMarking = new (Profile.Appearance.HairStyleId, new List<Color>() { hairColor.Value });
CMarkings.HairMarking = new (Profile.Appearance.HairStyleId, new List<Color> { hairColor.Value });
}
else
{
@@ -1159,7 +1197,7 @@ namespace Content.Client.Preferences.UI
{
if (_markingManager.CanBeApplied(Profile.Species, Profile.Sex, facialHairProto, _prototypeManager))
{
if (_markingManager.MustMatchSkin(Profile.Species, HumanoidVisualLayers.Hair, out var _, _prototypeManager))
if (_markingManager.MustMatchSkin(Profile.BodyType, HumanoidVisualLayers.Hair, out _, _prototypeManager))
{
facialHairColor = Profile.Appearance.SkinColor;
}
@@ -1171,7 +1209,7 @@ namespace Content.Client.Preferences.UI
}
if (facialHairColor != null)
{
CMarkings.FacialHairMarking = new (Profile.Appearance.FacialHairStyleId, new List<Color>() { facialHairColor.Value });
CMarkings.FacialHairMarking = new (Profile.Appearance.FacialHairStyleId, new List<Color> { facialHairColor.Value });
}
else
{
@@ -1237,6 +1275,7 @@ namespace Content.Client.Preferences.UI
//WD-EDIT
UpdateTTSVoicesControls();
UpdateBodyTypes();
//WD-EDIT
_preferenceUnavailableButton.SelectId((int) Profile.PreferenceUnavailable);
@@ -1299,6 +1338,14 @@ namespace Content.Client.Preferences.UI
return allowedSpecies;
}
private void SetBodyType(string newBodyType)
{
Profile = Profile?.WithBodyType(newBodyType);
IsDirty = true;
_needUpdatePreview = true;
}
//WD EDIT END
private void UpdateJobPriorities()
@@ -1337,7 +1384,7 @@ namespace Content.Client.Preferences.UI
Options.OnItemSelected += args => Options.Select(args.Id);
_requirementsLabel = new Label()
_requirementsLabel = new Label
{
Text = Loc.GetString("role-timer-locked"),
Visible = true,
@@ -1345,7 +1392,7 @@ namespace Content.Client.Preferences.UI
StyleClasses = {StyleBase.StyleClassLabelSubText},
};
_lockStripe = new StripeBack()
_lockStripe = new StripeBack
{
Visible = false,
HorizontalExpand = true,
@@ -1369,7 +1416,7 @@ namespace Content.Client.Preferences.UI
Options.AddItem(Loc.GetString(text), value);
}
var titleLabel = new Label()
var titleLabel = new Label
{
Margin = new Thickness(5f, 0, 5f, 0),
Text = title,