2 using Microsoft.Xna.Framework;
4 using System.Collections.Generic;
23 if (!tags.TryGetValue(
"jobid".ToIdentifier(), out
string jobId)) {
return; }
24 if (!jobId.IsNullOrEmpty())
32 int disguisedHairIndex = idCard.OwnerHairIndex;
33 int disguisedBeardIndex = idCard.OwnerBeardIndex;
34 int disguisedMoustacheIndex = idCard.OwnerMoustacheIndex;
35 int disguisedFaceAttachmentIndex = idCard.OwnerFaceAttachmentIndex;
36 Color hairColor = idCard.OwnerHairColor;
37 Color facialHairColor = idCard.OwnerFacialHairColor;
38 Color skinColor = idCard.OwnerSkinColor;
39 var tags = idCard.OwnerTagSet;
52 if (!limbElement.
GetAttributeString(
"type",
"").Equals(
"head", StringComparison.OrdinalIgnoreCase)) {
continue; }
55 if (spriteElement ==
null) {
continue; }
60 string fileName = Path.GetFileNameWithoutExtension(spritePath);
63 foreach (
string file
in Directory.GetFiles(Path.GetDirectoryName(spritePath)))
65 if (!file.EndsWith(
".png", StringComparison.OrdinalIgnoreCase))
69 string fileWithoutTags = Path.GetFileNameWithoutExtension(file);
70 fileWithoutTags = fileWithoutTags.Split(
'[',
']').First();
71 if (fileWithoutTags != fileName) {
continue; }
72 Portrait =
new Sprite(spriteElement,
"", file) { RelativeOrigin = Vector2.Zero };
82 float baldnessChance = 0.1f;
84 List<ContentXElement> createElementList(
WearableType wearableType,
float emptyCommonness = 1.0f)
87 wearableType, emptyCommonness);
89 var disguisedHairs = createElementList(
WearableType.Hair, baldnessChance);
90 var disguisedBeards = createElementList(
WearableType.Beard);
91 var disguisedMoustaches = createElementList(
WearableType.Moustache);
92 var disguisedFaceAttachments = createElementList(
WearableType.FaceAttachment);
94 ContentXElement getElementFromList(List<ContentXElement> list,
int index)
99 var disguisedHairElement = getElementFromList(disguisedHairs, disguisedHairIndex);
100 var disguisedBeardElement = getElementFromList(disguisedBeards, disguisedBeardIndex);
101 var disguisedMoustacheElement = getElementFromList(disguisedMoustaches, disguisedMoustacheIndex);
102 var disguisedFaceAttachmentElement = getElementFromList(disguisedFaceAttachments, disguisedFaceAttachmentIndex);
108 foreach (var s
in element?.GetChildElements(
"sprite") ?? Enumerable.Empty<
ContentXElement>())
Stores information about the Character that is needed between rounds in the menu etc....
IEnumerable< ContentXElement > FilterElements(IEnumerable< ContentXElement > elements, ImmutableHashSet< Identifier > tags, WearableType? targetType=null)
readonly bool HasSpecifierTags
IEnumerable< ContentXElement > Wearables
static List< ContentXElement > AddEmpty(IEnumerable< ContentXElement > elements, WearableType type, float commonness=1)
string ReplaceVars(string str)
static bool IsValidIndex(int index, List< ContentXElement > list)
string? GetAttributeString(string key, string? def)
IEnumerable< ContentXElement > Elements()
ContentPath? GetAttributeContentPath(string key)
ContentXElement? GetChildElement(string name)
virtual ContentXElement? MainElement
OwnerAppearance StoredOwnerAppearance
static JobPrefab Get(Identifier identifier)
void ExtractJobPrefab(IReadOnlyDictionary< Identifier, string > tags)
void ExtractAppearance(CharacterInfo characterInfo, IdCard idCard)
List< WearableSprite > Attachments