Class Clothes
A set of information and a registry for clothing items (and hair) that a Person can wear. Custom clothes can be registered using Register(Clothes).
[JsonConverter(typeof(StaticJsonConverter<Clothes>), new object[] { typeof(Clothes), "PrivateTypes" })]
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, Person, 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, Person, 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
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
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 Person, 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, Person, 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 Adult.
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 GetDepth(ClothesLayer).
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, Person, 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
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
RandomColorWeight
An optional function that determines the weight that this clothing item's given color index has when randomly generating an Outfit for a Person. 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<Clothes, ColorScheme, int, float> RandomColorWeight { get; init; }
Property Value
- Func<Clothes, ColorScheme, int, float>
RandomWeight
An optional function that determines the weight that this clothing item has when randomly generating an Outfit for a Person. 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<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(Person)
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(Person person)
Parameters
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.