Table of Contents

Class FenceType

Namespace
TinyLife.Objects
Assembly
Tiny Life.dll

A fence type is a set of underlying, unchanging settinsg for a FenceWall object. Fence types can be registered using Register(FenceType).

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

Constructors

FenceType(string, float, TextureRegion, Dictionary<Point, TextureRegion>, Point, params ColorScheme[])

Creates a new fence type with the given settings.

public FenceType(string name, float price, TextureRegion icon, Dictionary<Point, TextureRegion> textures, Point textureRegion, params ColorScheme[] colorSchemes)

Parameters

name string

The name of this fence type.

price float

The price of a single element of this fence type.

icon TextureRegion

The build mode icon that this fence type optionally uses.

textures Dictionary<Point, TextureRegion>

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

textureRegion Point

The texture region on this fence's type <see cref="Textures"/> that marks the base region for this fence type.

colorSchemes ColorScheme[]

The color schemes that each layer of this fence type uses.

FenceType(string, float, TextureRegion, Dictionary<Point, TextureRegion>, Point, ColorSettings)

Creates a new fence type with the given settings.

public FenceType(string name, float price, TextureRegion icon, Dictionary<Point, TextureRegion> textures, Point textureRegion, ColorSettings colors)

Parameters

name string

The name of this fence type.

price float

The price of a single element of this fence type.

icon TextureRegion

The build mode icon that this fence type optionally uses.

textures Dictionary<Point, TextureRegion>

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

textureRegion Point

The texture region on this fence's type <see cref="Textures"/> that marks the base region for this fence type.

colors ColorSettings

The color settings that this fence type uses.

Fields

Colors

The color settings to use for this fence wall.

public readonly ColorSettings Colors

Field Value

ColorSettings

Icon

The build mode icon that this fence type optionally uses.

public readonly TextureRegion Icon

Field Value

TextureRegion

Name

The name of this fence type.

public readonly string Name

Field Value

string

Price

The price of a single element of this fence type.

public readonly float Price

Field Value

float

TextureRegion

The texture region on this fence's type Textures that marks the base region for this fence type. Additional regions are gathered to the right of this region.

public readonly Point TextureRegion

Field Value

Point

Textures

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

public readonly Dictionary<Point, TextureRegion> Textures

Field Value

Dictionary<Point, TextureRegion>

Types

The set of all registered fence types, including vanilla and modded ones.

public static readonly ReadOnlyDictionary<string, FenceType> Types

Field Value

ReadOnlyDictionary<string, FenceType>

Methods

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

Draws this fence type at the given location with the given settings.

public virtual void Draw(GameTime time, SpriteBatch batch, Map map, Point pos1, Point pos2, int floor, Vector2 drawPos, bool vertical, float scale, bool hasPoleNeg, bool hasPolePos, int[] colors, Direction2 cameraRotation, Color? overrideColor = null)

Parameters

time GameTime

The game time.

batch SpriteBatch

The sprite batch to use for drawing.

map Map

The map this fence wall is on.

pos1 Point

The first position in the Positions array.

pos2 Point

The second position in the Positions array.

floor int

The floor.

drawPos Vector2

The position, in screen space, to draw at.

vertical bool

Whether the fence wall is vertical.

scale float

The scale to draw with.

hasPoleNeg bool

Whether the fence drawn has a pole in the negative direction.

hasPolePos bool

Whether the fence drawn has a pole in the positive direction.

colors int[]

The color indices in this fence type's Colors to draw with.

cameraRotation Direction2

The camera rotation to draw with.

overrideColor Color?

An optional override color to use instead of this fence type's Colors.

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

Draws this fence in UI space, based on the position and size of the given MLEM.Ui.Elements.Element.

public virtual void DrawUi(Element e, SpriteBatch batch, GameTime time, Map map, int[] colors, float drawScale)

Parameters

e Element

The element to base position and size on.

batch SpriteBatch

The sprite batch to use for drawing.

time GameTime

The game time.

map Map

The map.

colors int[]

The color indices in this fence type's Colors to draw with.

drawScale float

The scale to draw with.

Register(FenceType)

Registers the given fence type into the Types registry and returns it.

public static FenceType Register(FenceType type)

Parameters

type FenceType

The fence type to register.

Returns

FenceType

The registered fence type type.