added Character Setup (#511)

* added Character Setup

* whoops

* reverted unrelated changes

* Made everything work post-rebase

* Removed unused PreferencesChanged event

* nope, don't need this

* HumanoidProfileEditorPanel -> HumanoidProfileEditor

* Set initial data for hair pickers

* Fixed nullable warning

* Renamed LooksComponent -> HumanoidAppearanceComponent

* Renamed LooksComponentState -> HumanoidAppearanceComponentState

* Final renaming maybe

* Use a human-like dummy instead of a real human

* Change preferences structs back to classes
This commit is contained in:
DamianX
2020-01-18 01:54:13 +01:00
committed by Pieter-Jan Briers
parent d03da83fda
commit a4e369e629
41 changed files with 1423 additions and 756 deletions

View File

@@ -6,21 +6,49 @@ namespace Content.Shared.Preferences
[Serializable, NetSerializable]
public class HumanoidCharacterProfile : ICharacterProfile
{
public static HumanoidCharacterProfile Default()
public HumanoidCharacterProfile(string name,
int age,
Sex sex,
HumanoidCharacterAppearance appearance)
{
return new HumanoidCharacterProfile
{
Name = "John Doe",
Age = 18,
Sex = Sex.Male,
CharacterAppearance = HumanoidCharacterAppearance.Default()
};
Name = name;
Age = age;
Sex = sex;
Appearance = appearance;
}
public string Name { get; set; }
public int Age { get; set; }
public Sex Sex { get; set; }
public ICharacterAppearance CharacterAppearance { get; set; }
public static HumanoidCharacterProfile Default()
{
return new HumanoidCharacterProfile("John Doe", 18, Sex.Male, HumanoidCharacterAppearance.Default());
}
public string Name { get; }
public int Age { get; }
public Sex Sex { get; }
public ICharacterAppearance CharacterAppearance => Appearance;
public HumanoidCharacterAppearance Appearance { get; }
public HumanoidCharacterProfile WithName(string name)
{
return new HumanoidCharacterProfile(name, Age, Sex, Appearance);
}
public HumanoidCharacterProfile WithAge(int age)
{
return new HumanoidCharacterProfile(Name, age, Sex, Appearance);
}
public HumanoidCharacterProfile WithSex(Sex sex)
{
return new HumanoidCharacterProfile(Name, Age, sex, Appearance);
}
public HumanoidCharacterProfile WithCharacterAppearance(HumanoidCharacterAppearance appearance)
{
return new HumanoidCharacterProfile(Name, Age, Sex, appearance);
}
public string Summary => $"{Name}, {Age} years old {Sex.ToString().ToLower()} human.\nOccupation: to be implemented.";
public bool MemberwiseEquals(ICharacterProfile maybeOther)
{
@@ -28,9 +56,7 @@ namespace Content.Shared.Preferences
if (Name != other.Name) return false;
if (Age != other.Age) return false;
if (Sex != other.Sex) return false;
if (CharacterAppearance is null)
return other.CharacterAppearance is null;
return CharacterAppearance.MemberwiseEquals(other.CharacterAppearance);
return Appearance.MemberwiseEquals(other.Appearance);
}
}
}