Clothing and pronoun fields (#2689)
* Clothing & Gender fields: Add to database [MODIFIED TO NOT DEPEND ON SAPHIRE-DB-REFACTOR] Sorry about this, Saphire. * Clothing & Gender fields: Add UI [FALLBACK II] * Clothing & Gender fields: Actually apply gender * Clothing & Gender fields: Import innerclothingskirt field from my previous attempt Couldn't import actual prototypes because of a change to IDs * Clothing & Gender fields: Add innerclothingskirt field to everything * Clothing & Gender fields: Jumpskirts now work * Clothing & Gender fields: Gender field will follow sex field if it's not different (UX improvement) [FALLBACK II] * Clothing & Gender fields: Gender -> Pronouns to reduce confusion. Also, fix profile summary. Properly. [FALLBACK II] * Clothing & Pronoun fields: Refactor so that profile equipment adjustments are performed in StartingGearPrototype.
This commit is contained in:
@@ -17,6 +17,7 @@ using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using Robust.Shared.Localization.Macros;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -40,7 +41,8 @@ namespace Content.Client.UserInterface
|
||||
private readonly Button _saveButton;
|
||||
private readonly Button _sexFemaleButton;
|
||||
private readonly Button _sexMaleButton;
|
||||
private readonly Button _sexClassifiedButton;
|
||||
private readonly OptionButton _genderButton;
|
||||
private readonly OptionButton _clothingButton;
|
||||
private readonly HairStylePicker _hairPicker;
|
||||
private readonly FacialHairStylePicker _facialHairPicker;
|
||||
|
||||
@@ -165,27 +167,34 @@ namespace Content.Client.UserInterface
|
||||
Text = Loc.GetString("Male"),
|
||||
Group = sexButtonGroup
|
||||
};
|
||||
_sexMaleButton.OnPressed += args => { SetSex(Sex.Male); };
|
||||
_sexMaleButton.OnPressed += args =>
|
||||
{
|
||||
SetSex(Sex.Male);
|
||||
if (Profile.Gender == Gender.Female)
|
||||
{
|
||||
SetGender(Gender.Male);
|
||||
UpdateGenderControls();
|
||||
}
|
||||
};
|
||||
|
||||
_sexFemaleButton = new Button
|
||||
{
|
||||
Text = Loc.GetString("Female"),
|
||||
Group = sexButtonGroup
|
||||
};
|
||||
_sexFemaleButton.OnPressed += args => { SetSex(Sex.Female); };
|
||||
|
||||
_sexClassifiedButton = new Button
|
||||
_sexFemaleButton.OnPressed += args =>
|
||||
{
|
||||
/* DUR WHAT IF I PUT ATTACK HELICOPTER HERE DUR HUR AHUHRUHWUIDHAEILUBFOWEL(*&RFH#W*(OBFD&*/
|
||||
Text = Loc.GetString("Classified"),
|
||||
Group = sexButtonGroup
|
||||
SetSex(Sex.Female);
|
||||
if (Profile.Gender == Gender.Male)
|
||||
{
|
||||
SetGender(Gender.Female);
|
||||
UpdateGenderControls();
|
||||
}
|
||||
};
|
||||
_sexClassifiedButton.OnPressed += args => { SetSex(Sex.Classified); };
|
||||
|
||||
hBox.AddChild(sexLabel);
|
||||
hBox.AddChild(_sexMaleButton);
|
||||
hBox.AddChild(_sexFemaleButton);
|
||||
hBox.AddChild(_sexClassifiedButton);
|
||||
panel.AddChild(hBox);
|
||||
sexAndAgeRow.AddChild(panel);
|
||||
}
|
||||
@@ -213,6 +222,34 @@ namespace Content.Client.UserInterface
|
||||
|
||||
#endregion Age
|
||||
|
||||
#region Gender
|
||||
|
||||
{
|
||||
var panel = HighlightedContainer();
|
||||
var hBox = new HBoxContainer();
|
||||
var genderLabel = new Label { Text = Loc.GetString("Pronouns:") };
|
||||
|
||||
_genderButton = new OptionButton();
|
||||
|
||||
_genderButton.AddItem(Loc.GetString("He / Him"), (int) Gender.Male);
|
||||
_genderButton.AddItem(Loc.GetString("She / Her"), (int) Gender.Female);
|
||||
_genderButton.AddItem(Loc.GetString("They / Them"), (int) Gender.Epicene);
|
||||
_genderButton.AddItem(Loc.GetString("It / It"), (int) Gender.Neuter);
|
||||
|
||||
_genderButton.OnItemSelected += args =>
|
||||
{
|
||||
_genderButton.SelectId(args.Id);
|
||||
SetGender((Gender) args.Id);
|
||||
};
|
||||
|
||||
hBox.AddChild(genderLabel);
|
||||
hBox.AddChild(_genderButton);
|
||||
panel.AddChild(hBox);
|
||||
sexAndAgeRow.AddChild(panel);
|
||||
}
|
||||
|
||||
#endregion Gender
|
||||
|
||||
#region Hair
|
||||
|
||||
{
|
||||
@@ -270,6 +307,32 @@ namespace Content.Client.UserInterface
|
||||
}
|
||||
|
||||
#endregion Hair
|
||||
|
||||
#region Clothing
|
||||
|
||||
{
|
||||
var panel = HighlightedContainer();
|
||||
var hBox = new HBoxContainer();
|
||||
var clothingLabel = new Label { Text = Loc.GetString("Clothing:") };
|
||||
|
||||
_clothingButton = new OptionButton();
|
||||
|
||||
_clothingButton.AddItem(Loc.GetString("Jumpsuit"), (int) ClothingPreference.Jumpsuit);
|
||||
_clothingButton.AddItem(Loc.GetString("Jumpskirt"), (int) ClothingPreference.Jumpskirt);
|
||||
|
||||
_clothingButton.OnItemSelected += args =>
|
||||
{
|
||||
_clothingButton.SelectId(args.Id);
|
||||
SetClothing((ClothingPreference) args.Id);
|
||||
};
|
||||
|
||||
hBox.AddChild(clothingLabel);
|
||||
hBox.AddChild(_clothingButton);
|
||||
panel.AddChild(hBox);
|
||||
appearanceVBox.AddChild(panel);
|
||||
}
|
||||
|
||||
#endregion Clothing
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -588,12 +651,24 @@ namespace Content.Client.UserInterface
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
private void SetGender(Gender newGender)
|
||||
{
|
||||
Profile = Profile?.WithGender(newGender);
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
private void SetName(string newName)
|
||||
{
|
||||
Profile = Profile?.WithName(newName);
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
private void SetClothing(ClothingPreference newClothing)
|
||||
{
|
||||
Profile = Profile?.WithClothingPreference(newClothing);
|
||||
IsDirty = true;
|
||||
}
|
||||
|
||||
public void Save()
|
||||
{
|
||||
IsDirty = false;
|
||||
@@ -638,6 +713,16 @@ namespace Content.Client.UserInterface
|
||||
_sexFemaleButton.Pressed = true;
|
||||
}
|
||||
|
||||
private void UpdateGenderControls()
|
||||
{
|
||||
_genderButton.SelectId((int) Profile.Gender);
|
||||
}
|
||||
|
||||
private void UpdateClothingControls()
|
||||
{
|
||||
_clothingButton.SelectId((int) Profile.Clothing);
|
||||
}
|
||||
|
||||
private void UpdateHairPickers()
|
||||
{
|
||||
_hairPicker.SetData(
|
||||
@@ -667,6 +752,8 @@ namespace Content.Client.UserInterface
|
||||
if (Profile is null) return;
|
||||
UpdateNameEdit();
|
||||
UpdateSexControls();
|
||||
UpdateGenderControls();
|
||||
UpdateClothingControls();
|
||||
UpdateAgeEdit();
|
||||
UpdateHairPickers();
|
||||
UpdateSaveButton();
|
||||
|
||||
Reference in New Issue
Block a user