Search Results for

    Show / Hide Table of Contents

    Class RoofType

    A roof type stores settings and configurations for Roof instances. To register a new roof type, use Register(RoofType).

    Inheritance
    System.Object
    RoofType
    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.World
    Assembly: Tiny Life.dll
    Syntax
    [JsonConverter(typeof(StaticJsonConverter<RoofType>), new object[]{typeof(RoofType), "PrivateTypes"})]
    public class RoofType

    Constructors

    RoofType(String, Int32, ColorScheme, RoofStyle, TextureRegion, TextureRegion)

    Creates a new roof type with the given settings

    Declaration
    public RoofType(string name, int price, ColorScheme colors, RoofStyle style, TextureRegion texture, TextureRegion icon = null)
    Parameters
    Type Name Description
    System.String name

    The name that this roof type should have

    System.Int32 price

    The price for a 1x1 area of this roof type

    ColorScheme colors

    The color scheme that this roof type can have

    RoofStyle style

    The RoofStyle that this roof has

    MLEM.Textures.TextureRegion texture

    The texture that this roof should be drawn with

    MLEM.Textures.TextureRegion icon

    The icon that this roof should have in build mode

    Fields

    Colors

    The color scheme that this roof type can have

    Declaration
    public readonly ColorScheme Colors
    Field Value
    Type Description
    ColorScheme

    Icon

    The build mode 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 build mode button for this object.

    Declaration
    public readonly TextureRegion Icon
    Field Value
    Type Description
    MLEM.Textures.TextureRegion

    ModernFlat

    Declaration
    public static readonly RoofType ModernFlat
    Field Value
    Type Description
    RoofType

    Name

    The name of this roof type, which is used to store it to disk

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

    OldStyleFlat

    Declaration
    public static readonly RoofType OldStyleFlat
    Field Value
    Type Description
    RoofType

    Price

    The price of a 1x1 rectangle of this roof type

    Declaration
    public readonly int Price
    Field Value
    Type Description
    System.Int32

    RoundedShingles

    Declaration
    public static readonly RoofType RoundedShingles
    Field Value
    Type Description
    RoofType

    SheetMetal

    Declaration
    public static readonly RoofType SheetMetal
    Field Value
    Type Description
    RoofType

    SquareShingles

    Declaration
    public static readonly RoofType SquareShingles
    Field Value
    Type Description
    RoofType

    Style

    The RoofStyle that this roof has. If Draw(GameTime, SpriteBatch, Map, Rectangle, Direction2, Int32, Wallpaper, Single, Nullable<Color>) has completely custom behavior, the roof style is ignored, but can be set to Custom to signal this behavior to other mods.

    Declaration
    public readonly RoofStyle Style
    Field Value
    Type Description
    RoofStyle

    Texture

    The texture that this roof type has. For Gable roofs, this should be the leftmost texture of the texture set.

    Declaration
    public readonly TextureRegion Texture
    Field Value
    Type Description
    MLEM.Textures.TextureRegion

    Thatch

    Declaration
    public static readonly RoofType Thatch
    Field Value
    Type Description
    RoofType

    Types

    A registry of all of the RoofType instances that are currently registered

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

    Methods

    Draw(GameTime, SpriteBatch, Map, Rectangle, Direction2, Int32, Wallpaper, Single, Nullable<Color>)

    Draws the given Roof in world space

    Declaration
    public virtual void Draw(GameTime time, SpriteBatch batch, Map map, Rectangle area, Direction2 rotation, int colorIndex, Wallpaper wallpaper, float depthOffset = 0F, Color? overrideColor = null)
    Parameters
    Type Name Description
    Microsoft.Xna.Framework.GameTime time

    The game's current time

    Microsoft.Xna.Framework.Graphics.SpriteBatch batch

    The sprite batch to use for drawing

    Map map

    The map to draw on

    Microsoft.Xna.Framework.Rectangle area

    The area the roof covers

    MLEM.Misc.Direction2 rotation

    The roof's rotation

    System.Int32 colorIndex

    The color index in WarmDark

    Wallpaper wallpaper

    The wallpaper applied to the roof

    System.Single depthOffset

    The value that should be added to the depth of this roof

    System.Nullable<T><Microsoft.Xna.Framework.Color> overrideColor

    An override color that should be used instead of this roof's color, or null to use the roof's color.

    DrawUi(SpriteBatch, Element, Int32, Single)

    Draws a Roof in ui space, only drawing a 1x1 area of it

    Declaration
    public virtual void DrawUi(SpriteBatch batch, Element element, int colorIndex, float drawScale)
    Parameters
    Type Name Description
    Microsoft.Xna.Framework.Graphics.SpriteBatch batch

    The sprite batch to use for drawing

    MLEM.Ui.Elements.Element element

    The element to draw the roof on

    System.Int32 colorIndex

    The color index in WarmDark

    System.Single drawScale

    The scale to draw the roof with

    GetGableOffset(Rectangle, Direction2, Point)

    Returns the gable offset that Furniture attached to this roof should be displayed with. By default, this method returns an offset for roofs with the Gable Style.

    Declaration
    public virtual int GetGableOffset(Rectangle area, Direction2 rotation, Point innerPos)
    Parameters
    Type Name Description
    Microsoft.Xna.Framework.Rectangle area

    The area that the roof covers.

    MLEM.Misc.Direction2 rotation

    The roof's rotation.

    Microsoft.Xna.Framework.Point innerPos

    The position in the roof's area that the object sits on.

    Returns
    Type Description
    System.Int32

    The gable offset that this roof should have, in half tiles.

    GetPrice(Rectangle)

    Returns the price of this roof type for the given area. This returns Price, multiplied by the area's size.

    Declaration
    public virtual int GetPrice(Rectangle area)
    Parameters
    Type Name Description
    Microsoft.Xna.Framework.Rectangle area

    The area of roofing to get the price for

    Returns
    Type Description
    System.Int32

    The price of the area

    Register(RoofType)

    Registers a new roof type with the given settings into the Types registry

    Declaration
    public static RoofType Register(RoofType type)
    Parameters
    Type Name Description
    RoofType type

    The roof type to register

    Returns
    Type Description
    RoofType

    The roof type passed, for chaining

    Extension Methods

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