Table of Contents

Class StairsType

Namespace
TinyLife.World
Assembly
Tiny Life.dll

A stairs type is a set of settings for a Stairs object that is unchanged between individual stairs objects. Stairs types can be registered using Register(StairsType).

[JsonConverter(typeof(MigratingStaticJsonConverter<StairsType>), new object[] { typeof(StairsType), "PrivateTypes" })]
public class StairsType
Inheritance
StairsType
Inherited Members
Extension Methods

Constructors

StairsType(string, int, Dictionary<Point, TextureRegion>, Point, bool, TextureRegion, params ColorScheme[])

Creates a new stairs type with the given settings.

public StairsType(string name, int price, Dictionary<Point, TextureRegion> textures, Point textureRegion, bool allowsWallpaper, TextureRegion icon, params ColorScheme[] colorSchemes)

Parameters

name string

The name of this stairs type.

price int

The price of this stairs type.

textures Dictionary<Point, TextureRegion>

The texture atlas that this stairs type's <see cref="TextureRegion"/> is on.

textureRegion Point

The texture region of this stairs type on the <see cref="Textures"/> texture atlas.

allowsWallpaper bool

Whether this stairs type supports applying wallpaper.

icon TextureRegion

The icon for this stairs type.

colorSchemes ColorScheme[]

The color schemes for each layer of this stairs type.

StairsType(string, int, Dictionary<Point, TextureRegion>, Point, bool, TextureRegion, ColorSettings)

Creates a new stairs type with the given settings.

public StairsType(string name, int price, Dictionary<Point, TextureRegion> textures, Point textureRegion, bool allowsWallpaper, TextureRegion icon, ColorSettings colors)

Parameters

name string

The name of this stairs type.

price int

The price of this stairs type.

textures Dictionary<Point, TextureRegion>

The texture atlas that this stairs type's <see cref="TextureRegion"/> is on.

textureRegion Point

The texture region of this stairs type on the <see cref="Textures"/> texture atlas.

allowsWallpaper bool

Whether this stairs type supports applying wallpaper.

icon TextureRegion

The icon for this stairs type.

colors ColorSettings

The color schemes for each layer of this stairs type.

StairsType(string, int, Dictionary<Point, TextureRegion>, Point, bool, params ColorScheme[])

Creates a new stairs type with the given settings.

public StairsType(string name, int price, Dictionary<Point, TextureRegion> textures, Point textureRegion, bool hasWallpaper, params ColorScheme[] colorSchemes)

Parameters

name string

The name of this stairs type.

price int

The price of this stairs type.

textures Dictionary<Point, TextureRegion>

The texture atlas that this stairs type's <see cref="TextureRegion"/> is on.

textureRegion Point

The texture region of this stairs type on the <see cref="Textures"/> texture atlas.

hasWallpaper bool

Whether this stairs type supports applying wallpaper.

colorSchemes ColorScheme[]

The color schemes for each layer of this stairs type.

Fields

AllowsWallpaper

Whether this stairs type supports applying wallpaper.

public readonly bool AllowsWallpaper

Field Value

bool

BasicWood

public static readonly StairsType BasicWood

Field Value

StairsType

Colors

The color settings these stairs use.

public readonly ColorSettings Colors

Field Value

ColorSettings

Icon

The icon for this stairs type.

public readonly TextureRegion Icon

Field Value

TextureRegion

Industrial

public static readonly StairsType Industrial

Field Value

StairsType

Name

The name of this stairs type.

public readonly string Name

Field Value

string

Price

The price of this stairs type.

public readonly int Price

Field Value

int

TextureRegion

The texture region of this stairs type on the Textures texture atlas. Additional regions are automtaically gathered to the right of this texture region.

public readonly Point TextureRegion

Field Value

Point

Textures

The texture atlas that this stairs type's TextureRegion is on.

public readonly Dictionary<Point, TextureRegion> Textures

Field Value

Dictionary<Point, TextureRegion>

Types

The set of all currently registered stairs types.

public static readonly ReadOnlyDictionary<string, StairsType> Types

Field Value

ReadOnlyDictionary<string, StairsType>

Methods

Draw(GameTime, SpriteBatch, Map, Point, int, Vector2, Direction2, Direction2, int[], Wallpaper, float, float, Color?)

Draws this stairs type in the world.

public virtual void Draw(GameTime time, SpriteBatch batch, Map map, Point position, int floor, Vector2 drawPos, Direction2 rotation, Direction2 visualRotation, int[] colorIndices, Wallpaper wallpaper, float scale = 1, float depthOffset = 0, Color? overrideColor = null)

Parameters

time GameTime

The game time.

batch SpriteBatch

The sprite batch to use for drawing.

map Map

The map to use as a basis for column-based drawing.

position Point

The world position to use for drawing.

floor int

The floor to use for drawing.

drawPos Vector2

The draw position, or screen position, to use for drawing.

rotation Direction2

The rotation, in world space.

visualRotation Direction2

The visual rotation, optionally with camera rotation applied.

colorIndices int[]

The color indices to use for each Colors entry.

wallpaper Wallpaper

The wallpaper to draw on this stairs type, or null to draw none.

scale float

The scale to draw with.

depthOffset float

An optional added depth offset.

overrideColor Color?

A color that should optionally be used for drawing instead of the passed colorIndices.

DrawUi(Element, SpriteBatch, GameTime, Map, int[], Wallpaper, float)

Draws this stairs type in a UI context, meaning the stairs are not currently in the world.

public virtual void DrawUi(Element e, SpriteBatch batch, GameTime time, Map map, int[] colorIndices, Wallpaper wallpaper, float drawScale = 0.3)

Parameters

e Element

The element to base scaling and positioning on.

batch SpriteBatch

The sprite batch to use for drawing.

time GameTime

The game time.

map Map

The map to use as a basis for column-based drawing.

colorIndices int[]

The color indices to use for each ColorSettings entry.

wallpaper Wallpaper

The wallpaper to draw the stairs with.

drawScale float

The scale to draw with.

Register(StairsType)

Registers the given stairs type into the Types registry.

public static StairsType Register(StairsType type)

Parameters

type StairsType

The stairs type to register.

Returns

StairsType

The registered stairs type, for chaining.