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

@@ -1,4 +1,5 @@
using System.IO;
using System.Linq;
using Content.Server.Preferences;
using Content.Shared.Preferences;
using NUnit.Framework;
@@ -12,23 +13,21 @@ namespace Content.Tests.Server.Preferences
{
private const int MaxCharacterSlots = 10;
private static ICharacterProfile CharlieCharlieson()
private static HumanoidCharacterProfile CharlieCharlieson()
{
return new HumanoidCharacterProfile
{
Name = "Charlie Charlieson",
Age = 21,
Sex = Sex.Male,
CharacterAppearance = new HumanoidCharacterAppearance()
{
HairStyleName = "Afro",
HairColor = Color.Aqua,
FacialHairStyleName = "Shaved",
FacialHairColor = Color.Aquamarine,
EyeColor = Color.Azure,
SkinColor = Color.Beige
}
};
return new HumanoidCharacterProfile(
"Charlie Charlieson",
21,
Sex.Male,
new HumanoidCharacterAppearance(
"Afro",
Color.Aqua,
"Shaved",
Color.Aquamarine,
Color.Azure,
Color.Beige
)
);
}
private static PreferencesDatabase GetDb()
@@ -52,7 +51,7 @@ namespace Content.Tests.Server.Preferences
var prefs = db.GetPlayerPreferences(username);
Assert.NotNull(prefs);
Assert.Zero(prefs.SelectedCharacterIndex);
Assert.That(prefs.Characters.TrueForAll(character => character is null));
Assert.That(prefs.Characters.ToList().TrueForAll(character => character is null));
}
[Test]
@@ -65,7 +64,7 @@ namespace Content.Tests.Server.Preferences
db.SaveSelectedCharacterIndex(username, slot);
db.SaveCharacterSlot(username, originalProfile, slot);
var prefs = db.GetPlayerPreferences(username);
Assert.That(prefs.Characters[slot].MemberwiseEquals(originalProfile));
Assert.That(prefs.Characters.ElementAt(slot).MemberwiseEquals(originalProfile));
}
[Test]
@@ -78,7 +77,7 @@ namespace Content.Tests.Server.Preferences
db.SaveCharacterSlot(username, CharlieCharlieson(), slot);
db.SaveCharacterSlot(username, null, slot);
var prefs = db.GetPlayerPreferences(username);
Assert.That(prefs.Characters.TrueForAll(character => character is null));
Assert.That(prefs.Characters.ToList().TrueForAll(character => character is null));
}
[Test]