Class Clothes
A set of information and a registry for clothing items (and hair) that a PersonLike can wear. Custom clothes can be registered using Register(Clothes).
[JsonConverter(typeof(MigratingStaticJsonConverter<Clothes>), new object[] { typeof(Clothes), "PrivateTypes", true })]
public class Clothes : IEmotionSource
- Inheritance
-
Clothes
- Implements
- Inherited Members
- Extension Methods
Constructors
Clothes(string, ClothesLayer, IReadOnlyDictionary<Point, TextureRegion>, Point, float, ClothesIntention, StylePreference, params ColorScheme[])
Creates a new clothes item with the given data, producing a texture layout according to the rules described in https://docs.tinylifegame.com/articles/creating_textures.html.
public Clothes(string name, ClothesLayer layer, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, float price, ClothesIntention intentions, StylePreference stylePreference, params ColorScheme[] colors)
Parameters
name
stringThe name of this clothes item
layer
ClothesLayerThe ClothesLayer that this clothes item should render on
textures
IReadOnlyDictionary<Point, TextureRegion>The texture atlas to use for this clothing item.
textureRegion
PointThe top left (standing frame 1) TextureRegion that this clothes item uses in the world
price
floatThe price of this piece of clothing
intentions
ClothesIntentionA set of ClothesIntention flags that determine what this clothes item can be used for
stylePreference
StylePreferenceThe style preference that this clothing item falls into. A clothing item's style preference slightly influences whether it will be chosen in SetRandomClothesItem(Random, PersonLike, ClothesLayer, ClothesIntention, StylePreference?, bool, int, Func<Clothes, bool>).
colors
ColorScheme[]The set of ColorSchemes that this clothes item can have its colors selected from, where each entry corresponds to a texture layer.
Clothes(string, ClothesLayer, IReadOnlyDictionary<Point, TextureRegion>, Point, float, ClothesIntention, StylePreference, ColorSettings)
Creates a new clothes item with the given data, producing a texture layout according to the rules described in https://docs.tinylifegame.com/articles/creating_textures.html.
public Clothes(string name, ClothesLayer layer, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, float price, ClothesIntention intentions, StylePreference stylePreference, ColorSettings colors)
Parameters
name
stringThe name of this clothes item
layer
ClothesLayerThe ClothesLayer that this clothes item should render on
textures
IReadOnlyDictionary<Point, TextureRegion>The texture atlas to use for this clothing item.
textureRegion
PointThe top left (standing frame 1) TextureRegion that this clothes item uses in the world
price
floatThe price of this piece of clothing
intentions
ClothesIntentionA set of ClothesIntention flags that determine what this clothes item can be used for
stylePreference
StylePreferenceThe style preference that this clothing item falls into. A clothing item's style preference slightly influences whether it will be chosen in SetRandomClothesItem(Random, PersonLike, ClothesLayer, ClothesIntention, StylePreference?, bool, int, Func<Clothes, bool>).
colors
ColorSettingsThe set of ColorSchemes that this clothes item can have its colors selected from, where each entry corresponds to a texture layer.
Fields
AlienSkinColors
Stores all of the color schemes and their corresponding color indices for the Body layer which are considered "alien", ie not usually seen on humans. For color indices in this list, a much lower priority is automatically returned in RandomColorWeight.
public static readonly Dictionary<ColorScheme, HashSet<int>> AlienSkinColors
Field Value
AllIntentions
A set of all valid ClothesIntention values
public static readonly ClothesIntention[] AllIntentions
Field Value
Colors
The set of ColorSchemes that this clothes item can have its colors selected from, where each entry corresponds to a texture layer gathered from the Textures based on the TextureRegion, according to the rules described in https://docs.tinylifegame.com/articles/creating_textures.html.
public readonly ColorSettings Colors
Field Value
DefaultDepths
Stores the default depth for each ClothesLayer when rendering. The default depth is the index of the layer in the Layers array.
public static readonly Dictionary<ClothesLayer, int> DefaultDepths
Field Value
DyedHairColors
Stores all of the color schemes and their corresponding color indices for the Hair and FacialHair layers which are considered dyed, ie not usually seen on humans. For color indices in this list, a much lower priority is automatically returned in RandomColorWeight.
public static readonly Dictionary<ColorScheme, HashSet<int>> DyedHairColors
Field Value
ExtremeEyeColors
Stores all of hte color schemes and their corresponding color indices for the Eyes layer which are considered "extreme", ie not usually seen with the same brightness or intensity on humans. For color indices in this list, a much lower priority is automatically returned in RandomColorWeight.
public static readonly Dictionary<ColorScheme, HashSet<int>> ExtremeEyeColors
Field Value
GrayHairColors
Stores all of the color schemes and their corresponding color indices for the Hair and FacialHair layers which are considered gray hair, ie hair that usually older people have. For color indices in this list, a much higher priority is automatically returned in RandomColorWeight for people of the elder age group, and a color from this list may randomly be chosen when a PersonLike ages up to an elder.
public static readonly Dictionary<ColorScheme, HashSet<int>> GrayHairColors
Field Value
Intentions
A set of ClothesIntention flags that determine what this clothes item can be used for.
public readonly ClothesIntention Intentions
Field Value
Layer
The ClothesLayer that this clothes item should render on
public readonly ClothesLayer Layer
Field Value
Layers
A set of all valid ClothesLayer values
public static readonly ClothesLayer[] Layers
Field Value
Name
The name of this clothes item. Since this is used for the Types registry, the name must be unique across mods.
public readonly string Name
Field Value
Price
The price of this piece of clothing.
public readonly float Price
Field Value
ReferencePrice
The reference price for a piece of clothing. When clothes items are randomly chosen for a new PersonLike, the items chosen will be guaranteed to have a price equal to or below this value.
public const int ReferencePrice = 50
Field Value
StylePreference
The style preference that this clothing item falls into. A clothing item's style preference slightly influences whether it will be chosen in SetRandomClothesItem(Random, PersonLike, ClothesLayer, ClothesIntention, StylePreference?, bool, int, Func<Clothes, bool>). The style preference is not exposed to players.
public readonly StylePreference StylePreference
Field Value
StylePreferences
A set of all valid StylePreference values.
public static readonly StylePreference[] StylePreferences
Field Value
TextureRegion
This clothing's initial, top left texture region, with additional regions laid out according to the rules described in https://docs.tinylifegame.com/articles/creating_textures.html.
public readonly Point TextureRegion
Field Value
- Point
Textures
The texture atlas that this clothing item uses, which its base TextureRegion, animation frames and additional Colors are contained in.
public readonly IReadOnlyDictionary<Point, TextureRegion> Textures
Field Value
- IReadOnlyDictionary<Point, TextureRegion>
Types
A registry that contains all Clothes in the game and all mods
public static readonly ReadOnlyDictionary<string, Clothes> Types
Field Value
Properties
Ages
The age groups that are allowed to wear these clothes. Defaults to AdultOrOlder.
public AgeGroup Ages { get; init; }
Property Value
DepthFunction
A function that determines the depth with which this clothes item is rendered based on the given Pose, their rotation, and the layer of this clothes item being rendered. This function defaults to returning the corresponding entry in DefaultDepths.
public Func<(Pose Pose, Direction2 Rotation, int Layer), float> DepthFunction { get; init; }
Property Value
Description
A function that can optionally determine a set of additional text strings that are added to this clothes item's description in the CharacterCreator. To do so, simply add to the passed List<T>.
public Action<Clothes, PersonLike, List<string>> Description { get; init; }
Property Value
Icon
The character creator icon for this object, which represents the category / theme / mod that it comes from. If this value is nonnull, the icon will be displayed in the corner of the character creator button for this object.
public TextureRegion Icon { get; init; }
Property Value
- TextureRegion
IsIncompatible
An optional function that determines whether this clothing item is incompatible with the passed clothing item. If this function returns true, the other clothing item is removed from an Outfit when this item gets added.
public Func<Clothes, Clothes, bool> IsIncompatible { get; init; }
Property Value
LayersToHide
A set of ClothesLayer flags that determines which clothes layers are hidden when this clothing item is being worn. This is used by objects like the headscarf, which hides hair.
public ClothesLayer LayersToHide { get; init; }
Property Value
Migrations
The set of migrations that should be applied to clothes of this type when they are loaded from disk.
public List<Migration<WornClothes>> Migrations { get; init; }
Property Value
NonBuyable
This value determines whether this clothes item can be bought in the character creator. If this value is false, the only way for this clothes item to be visible in the character creator is by adding it to the ClothesStorage.
public bool NonBuyable { get; init; }
Property Value
PersonType
The type of person that is allowed to wear these clothes. Defaults to the Person type.
public Type PersonType { get; init; }
Property Value
RandomColorWeight
An optional function that determines the weight that this clothing item's given color index has when randomly generating an Outfit for a PersonLike. The default weight for each clothing item's color is 1, and the higher the weight is, the more likely it is for the color to be chosen for an outfit.
public Func<AgeGroup, Clothes, ColorScheme, int, float> RandomColorWeight { get; init; }
Property Value
RandomWeight
An optional function that determines the weight that this clothing item has when randomly generating an Outfit for a PersonLike. The higher the weight is, the more likely it is for this item to be chosen for an outfit. The default weight for a clothing item is 3 if any of the outfit's Intentions match the clothing item's Intentions, and 1 otherwise.
public Func<AgeGroup, Clothes, Outfit, float> RandomWeight { get; init; }
Property Value
SourceString
A (localized) string that is displayed when hovering over an EmotionModifier that has this source
public string SourceString { get; }
Property Value
TextureBehaviorLayer
A ClothesLayer whose texture behavior should be used instead of the Layer's texture behavior. The texture behavior determines how many texture regions a clothes item uses, and whether they are animated in a certain Pose. For more information, see https://docs.tinylifegame.com/articles/creating_textures.html.
public ClothesLayer? TextureBehaviorLayer { get; init; }
Property Value
Methods
AreCompatible(Clothes, Clothes)
A utility function that checks the passed two Clothes items' IsIncompatible functions and returns whether they are compatible, meaning whether they can be worn together in the same Outfit.
public static bool AreCompatible(Clothes clothes, Clothes other)
Parameters
Returns
- bool
Whether the two clothes items are compatible.
GetDescription(PersonLike)
Returns this clothes item's description, which is displayed in the CharacterCreator. This method returns this clothes item's Intentions' description, as well as any additional description info returned by Description.
public IEnumerable<string> GetDescription(PersonLike person)
Parameters
person
PersonLikeThe person who is wearing this clothing item, or null.
Returns
- IEnumerable<string>
This clothes item's description.
Register(Clothes)
Register the given clothes instance to the Types registry
public static Clothes Register(Clothes clothes)
Parameters
clothes
ClothesThe clothes to register
Returns
- Clothes
The passed
clothes
, for chaining.