Files
tbd-station-14/Content.Shared/Preferences/HumanoidCharacterAppearance.cs
DamianX a4e369e629 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
2020-01-18 01:54:13 +01:00

88 lines
3.2 KiB
C#

using System;
using Robust.Shared.Maths;
using Robust.Shared.Serialization;
namespace Content.Shared.Preferences
{
[Serializable, NetSerializable]
public class HumanoidCharacterAppearance : ICharacterAppearance
{
public HumanoidCharacterAppearance(string hairStyleName,
Color hairColor,
string facialHairStyleName,
Color facialHairColor,
Color eyeColor,
Color skinColor)
{
HairStyleName = hairStyleName;
HairColor = hairColor;
FacialHairStyleName = facialHairStyleName;
FacialHairColor = facialHairColor;
EyeColor = eyeColor;
SkinColor = skinColor;
}
public string HairStyleName { get; }
public Color HairColor { get; }
public string FacialHairStyleName { get; }
public Color FacialHairColor { get; }
public Color EyeColor { get; }
public Color SkinColor { get; }
public HumanoidCharacterAppearance WithHairStyleName(string newName)
{
return new HumanoidCharacterAppearance(newName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
}
public HumanoidCharacterAppearance WithHairColor(Color newColor)
{
return new HumanoidCharacterAppearance(HairStyleName, newColor, FacialHairStyleName, FacialHairColor, EyeColor, SkinColor);
}
public HumanoidCharacterAppearance WithFacialHairStyleName(string newName)
{
return new HumanoidCharacterAppearance(HairStyleName, HairColor, newName, FacialHairColor, EyeColor, SkinColor);
}
public HumanoidCharacterAppearance WithFacialHairColor(Color newColor)
{
return new HumanoidCharacterAppearance(HairStyleName, HairColor, FacialHairStyleName, newColor, EyeColor, SkinColor);
}
public HumanoidCharacterAppearance WithEyeColor(Color newColor)
{
return new HumanoidCharacterAppearance(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, newColor, SkinColor);
}
public HumanoidCharacterAppearance WithSkinColor(Color newColor)
{
return new HumanoidCharacterAppearance(HairStyleName, HairColor, FacialHairStyleName, FacialHairColor, EyeColor, newColor);
}
public static HumanoidCharacterAppearance Default()
{
return new HumanoidCharacterAppearance
(
"Bald",
Color.Black,
"Shaved",
Color.Black,
Color.Black,
Color.Black
);
}
public bool MemberwiseEquals(ICharacterAppearance maybeOther)
{
if (!(maybeOther is HumanoidCharacterAppearance other)) return false;
if (HairStyleName != other.HairStyleName) return false;
if (HairColor != other.HairColor) return false;
if (FacialHairStyleName != other.FacialHairStyleName) return false;
if (FacialHairColor != other.FacialHairColor) return false;
if (EyeColor != other.EyeColor) return false;
if (SkinColor != other.SkinColor) return false;
return true;
}
}
}