Search Results for

    Show / Hide Table of Contents

    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).

    Inheritance
    System.Object
    Clothes
    Implements
    IPricedObject
    IEmotionSource
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: TinyLife.Objects
    Assembly: Tiny Life.dll
    Syntax
    [JsonConverter(typeof(StaticJsonConverter<Clothes>), new object[]{typeof(Clothes), "PrivateTypes"})]
    public class Clothes : IPricedObject, IEmotionSource

    Constructors

    Clothes(String, ClothesLayer, IReadOnlyDictionary<Point, TextureRegion>, Point, Single, ClothesIntention, ColorScheme[])

    Creates a new clothes item with the given data

    Declaration
    public Clothes(string name, ClothesLayer layer, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, float price, ClothesIntention intentions, params ColorScheme[] colors)
    Parameters
    Type Name Description
    System.String name

    The name of this clothes item

    ClothesLayer layer

    The ClothesLayer that this clothes item should render on

    System.Collections.Generic.IReadOnlyDictionary<Microsoft.Xna.Framework.Point, MLEM.Textures.TextureRegion> textures

    The texture atlas to use for this clothing item.

    Microsoft.Xna.Framework.Point textureRegion

    The top left (standing frame 1) TextureRegion that this clothes item uses in the world

    System.Single price

    The price of this piece of clothing

    ClothesIntention intentions

    A set of ClothesIntention flags that determine what this clothes item can be used for

    ColorScheme[] colors

    The ColorScheme that this clothes item can have its colors selected from

    Fields

    AllIntentions

    A set of all valid ClothesIntention values

    Declaration
    public static readonly ClothesIntention[] AllIntentions
    Field Value
    Type Description
    ClothesIntention[]

    Colors

    The set of ColorSchemes that this clothes item can have its colors selected from. The color scheme at index i will be mapped to the Textures entry at index i.

    Declaration
    public readonly ColorScheme[] Colors
    Field Value
    Type Description
    ColorScheme[]

    Intentions

    A set of ClothesIntention flags that determine what this clothes item can be used for.

    Declaration
    public readonly ClothesIntention Intentions
    Field Value
    Type Description
    ClothesIntention

    Layer

    The ClothesLayer that this clothes item should render on

    Declaration
    public readonly ClothesLayer Layer
    Field Value
    Type Description
    ClothesLayer

    Layers

    A set of all valid ClothesLayer values

    Declaration
    public static readonly ClothesLayer[] Layers
    Field Value
    Type Description
    ClothesLayer[]

    Name

    The name of this clothes item. Since this is used for the Types registry, the name must be unique across mods.

    Declaration
    public readonly string Name
    Field Value
    Type Description
    System.String

    Price

    The price of this piece of clothing. Use GetPrice() to retrieve this value for consistency.

    Declaration
    public readonly float Price
    Field Value
    Type Description
    System.Single

    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.

    Declaration
    public const int ReferencePrice = 50
    Field Value
    Type Description
    System.Int32

    TextureRegion

    This clothing's initial, top left texture region.

    Declaration
    public readonly Point TextureRegion
    Field Value
    Type Description
    Microsoft.Xna.Framework.Point

    Textures

    This clothing item's textures, based on the TextureRegion.

    Declaration
    public readonly IReadOnlyDictionary<Point, TextureRegion> Textures
    Field Value
    Type Description
    System.Collections.Generic.IReadOnlyDictionary<Microsoft.Xna.Framework.Point, MLEM.Textures.TextureRegion>

    Types

    A registry that contains all Clothes in the game and all mods

    Declaration
    public static readonly ReadOnlyDictionary<string, Clothes> Types
    Field Value
    Type Description
    System.Collections.ObjectModel.ReadOnlyDictionary<System.String, Clothes>

    Properties

    Ages

    The age groups that are allowed to wear these clothes. Defaults to Adult.

    Declaration
    public AgeGroup Ages { get; set; }
    Property Value
    Type Description
    AgeGroup

    DepthFunction

    A function that determines the depth with which this clothes item is rendered based on the given Person.Pose, their rotation, and the layer of this clothes item being rendered. This function defaults to returning GetDepth(ClothesLayer).

    Declaration
    public Func<(Person.Pose Pose, Direction2 Rotation, int Layer), float> DepthFunction { get; set; }
    Property Value
    Type Description
    System.Func<System.ValueTuple<Person.Pose, MLEM.Misc.Direction2, System.Int32>, System.Single>

    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.

    Declaration
    public TextureRegion Icon { get; set; }
    Property Value
    Type Description
    MLEM.Textures.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.

    Declaration
    public Func<Clothes, Clothes, bool> IsIncompatible { get; set; }
    Property Value
    Type Description
    System.Func<Clothes, Clothes, System.Boolean>

    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.

    Declaration
    public bool NonBuyable { get; set; }
    Property Value
    Type Description
    System.Boolean

    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.

    Declaration
    public Func<Clothes, ColorScheme, int, float> RandomColorWeight { get; set; }
    Property Value
    Type Description
    System.Func<Clothes, ColorScheme, System.Int32, System.Single>

    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.

    Declaration
    public Func<Clothes, Outfit, float> RandomWeight { get; set; }
    Property Value
    Type Description
    System.Func<Clothes, Outfit, System.Single>

    SourceString

    A (localized) string that is displayed when hovering over an EmotionModifier that has this source

    Declaration
    public string SourceString { get; }
    Property Value
    Type Description
    System.String

    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 Person.Pose. For more information, see https://docs.tinylifegame.com/articles/creating_textures.html.

    Declaration
    public ClothesLayer? TextureBehaviorLayer { get; set; }
    Property Value
    Type Description
    System.Nullable<ClothesLayer>

    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.

    Declaration
    public static bool AreCompatible(Clothes clothes, Clothes other)
    Parameters
    Type Name Description
    Clothes clothes

    The first clothes item.

    Clothes other

    The second clothes item.

    Returns
    Type Description
    System.Boolean

    Whether the two clothes items are compatible.

    GetClothes(ClothesLayer, AgeGroup)

    Returns the clothes from the Types registry that match the given Layer and optionally match the required Ages

    Declaration
    public static IEnumerable<Clothes> GetClothes(ClothesLayer layer, AgeGroup age = (AgeGroup)0)
    Parameters
    Type Name Description
    ClothesLayer layer

    The layer

    AgeGroup age

    The required ages, or 0 to allow all ages

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<Clothes>

    The clothes that match

    GetPrice()

    Returns the price that this object can be bought or sold for. Note that, like in the case of the Painting, the returned price isn't necessarily the full price that the object can be sold for. Instead, the price returned here should be the price that this object has when bought or sold from the FurnitureTool or similar.

    Declaration
    public float GetPrice()
    Returns
    Type Description
    System.Single

    The object's price

    Register(Clothes)

    Register the given clothes instance to the Types registry

    Declaration
    public static void Register(Clothes clothes)
    Parameters
    Type Name Description
    Clothes clothes

    The clothes to register

    Implements

    IPricedObject
    IEmotionSource

    Extension Methods

    Extensions.JsonCopy<T>(T)
    ☀
    ☾
    In This Article
    Back to top
    © 2021-2023 Ellpeck Games, Top Hat Studios – Impressum – Privacy – Status
    ☀
    ☾