Table of Contents

Class Wallpaper

Namespace
TinyLife.World
Assembly
Tiny Life.dll

A wallpaper is a single-instanced object that can be attached to a Wall, which makes the wall render a different texture. To register custom wallpapers, use Register(string, int, Dictionary<Point, TextureRegion>, Point, ColorScheme, TextureRegion, int?, Type). Note that registered wallpapers need to use a texture generated by ApplyMasks(Texture2D, int, int, RuntimeTexturePacker, Action<Dictionary<Point, TextureRegion>>).

[JsonConverter(typeof(Wallpaper.Converter))]
public class Wallpaper
Inheritance
Wallpaper
Inherited Members
Extension Methods

Constructors

Wallpaper(string, string, int, Dictionary<Point, TextureRegion>, Point, ColorSettings, int[], TextureRegion)

Creates a new wallpaper with the given settings. To create an instance of a custom wallpaper class, use Register(string, int, Dictionary<Point, TextureRegion>, Point, ColorScheme, TextureRegion, int?, Type).

protected Wallpaper(string baseName, string name, int price, Dictionary<Point, TextureRegion> textures, Point textureRegion, ColorSettings colorSettings, int[] colors, TextureRegion icon)

Parameters

baseName string
name string
price int
textures Dictionary<Point, TextureRegion>
textureRegion Point
colorSettings ColorSettings
colors int[]
icon TextureRegion

Fields

BaseName

The name of this type of wallpaper. Whereas Name has the index of its color scheme appended to it, this one is just the type's name.

public readonly string BaseName

Field Value

string

ColorSettings

The color settings used by this wallpaper.

public readonly ColorSettings ColorSettings

Field Value

ColorSettings

Colors

The set of colors applied to this wallpaper instance. Each entry represents an index in the ColorSettings of this wallpaper.

public readonly int[] Colors

Field Value

int[]

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.

public readonly TextureRegion Icon

Field Value

TextureRegion

Name

The name of this specific wallpaper. This is comprised of the BaseName with its color scheme index attached to it.

public readonly string Name

Field Value

string

Price

The price of this wallpaper. Can be retrieved easily using GetPrice().

public readonly int Price

Field Value

int

TextureRegion

The texture region on the Textures that this wallpaper's texture is located at. Additional texture regions will be gathered to the right of this region's coordinates.

public readonly Point TextureRegion

Field Value

Point

Textures

The texture regions that this wallpaper's TextureRegion is on.

public readonly Dictionary<Point, TextureRegion> Textures

Field Value

Dictionary<Point, TextureRegion>

Wallpapers

The registry for all Wallpaper objects in the game and mods. Use Register(string, int, Dictionary<Point, TextureRegion>, Point, ColorScheme, TextureRegion, int?, Type) to register custom wallpapers.

public static readonly ReadOnlyDictionary<string, Wallpaper[]> Wallpapers

Field Value

ReadOnlyDictionary<string, Wallpaper[]>

Methods

Draw(GameTime, SpriteBatch, Map, Point, Point, int, Vector2, WallMode, bool, bool, float, bool, float, Color?)

Draws this wallpaper on the given wall with the given data.

public virtual void Draw(GameTime time, SpriteBatch batch, Map map, Point pos1, Point pos2, int floor, Vector2 drawPos, WallMode mode, bool isDown, bool vertical, float scale, bool shadow, float depthOffset = 0, Color? overrideColor = null)

Parameters

time GameTime

The current game time

batch SpriteBatch

The sprite batch used for rendering

map Map

The map.

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 coordinates, that the wall should be drawn at

mode WallMode

The WallMode that the wall should be drawn with

isDown bool

Whether or not the wall is rendering with a reduced height

vertical bool

Whether or not the wall is vertical (or horizontal) in the world

scale float

The scale that the wall should be rendered with

shadow bool

Whether or not the shadow texture should be applied on top of the texture

depthOffset float

An offset that is optionally added to the draw depth.

overrideColor Color?

A color that this object should be rendered with, instead of its default color

DrawUi(Element, SpriteBatch, GameTime, Map, float)

Draws this wallpaper on the given MLEM.Ui.Elements.Element in ui space

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

Parameters

e Element

The element to draw on

batch SpriteBatch

The batch to draw with

time GameTime

The current game time

map Map

The map.

drawScale float

The scale to draw with.

GetPrice()

Returns the price for this wallpaper item.

public virtual float GetPrice()

Returns

float

The price.

Register(string, int, Dictionary<Point, TextureRegion>, Point, ColorScheme, TextureRegion, int?, Type)

Creates and registers a new wallpaper with the given settings. Note that the textures should be one generated using ApplyMasks(Texture2D, int, int, RuntimeTexturePacker, Action<Dictionary<Point, TextureRegion>>), as otherwise, graphical issues will occur.

public static Wallpaper[] Register(string name, int price, Dictionary<Point, TextureRegion> textures, Point textureRegion, ColorScheme color, TextureRegion icon = null, int? defaultColor = null, Type constructedType = null)

Parameters

name string

The name of the wallpaper type

price int

The price of a single wallpaper of this type

textures Dictionary<Point, TextureRegion>

The texture that this wallpaper should use. This needs to have been generated using ApplyMasks(Texture2D, int, int, RuntimeTexturePacker, Action<Dictionary<Point, TextureRegion>>).

textureRegion Point

The top left texture region of this wallpaper (on the original texture, not the mask)

color ColorScheme

The color scheme of the wallpaper.

icon TextureRegion

The build mode category icon of this object

defaultColor int?

The color that this wallpaper should display with by default in the wallpaper tool.

constructedType Type

The Type that should be constructed to create this wallpaper. Defaults to Wallpaper.

Returns

Wallpaper[]

Register(string, int, Dictionary<Point, TextureRegion>, Point, ColorScheme[], TextureRegion, int[], Type)

Creates and registers a new wallpaper with the given settings. Note that the textures should be one generated using ApplyMasks(Texture2D, int, int, RuntimeTexturePacker, Action<Dictionary<Point, TextureRegion>>), as otherwise, graphical issues will occur.

public static Wallpaper[] Register(string name, int price, Dictionary<Point, TextureRegion> textures, Point textureRegion, ColorScheme[] colors, TextureRegion icon = null, int[] defaultColors = null, Type constructedType = null)

Parameters

name string

The name of the wallpaper type

price int

The price of a single wallpaper of this type

textures Dictionary<Point, TextureRegion>

The texture that this wallpaper should use. This needs to have been generated using ApplyMasks(Texture2D, int, int, RuntimeTexturePacker, Action<Dictionary<Point, TextureRegion>>).

textureRegion Point

The top left texture region of this wallpaper (on the original texture, not the mask)

colors ColorScheme[]

The color schemes of the wallpaper.

icon TextureRegion

The build mode category icon of this object

defaultColors int[]

The colosr that this wallpaper should display with by default in the wallpaper tool.

constructedType Type

The Type that should be constructed to create this wallpaper. Defaults to Wallpaper.

Returns

Wallpaper[]

Register(string, int, Dictionary<Point, TextureRegion>, Point, ColorSettings, TextureRegion, Type)

Creates and registers a new wallpaper with the given settings. Note that the textures should be one generated using ApplyMasks(Texture2D, int, int, RuntimeTexturePacker, Action<Dictionary<Point, TextureRegion>>), as otherwise, graphical issues will occur.

public static Wallpaper[] Register(string name, int price, Dictionary<Point, TextureRegion> textures, Point textureRegion, ColorSettings colorSettings, TextureRegion icon = null, Type constructedType = null)

Parameters

name string

The name of the wallpaper type

price int

The price of a single wallpaper of this type

textures Dictionary<Point, TextureRegion>

The texture that this wallpaper should use. This needs to have been generated using ApplyMasks(Texture2D, int, int, RuntimeTexturePacker, Action<Dictionary<Point, TextureRegion>>).

textureRegion Point

The top left texture region of this wallpaper (on the original texture, not the mask)

colorSettings ColorSettings

The color schemes for each layer of the wallpaper. If there is more than one entry, additional layers will automatically be gathered to the right of the passed textureRegion.

icon TextureRegion

The build mode category icon of this object

constructedType Type

The Type that should be constructed to create this wallpaper. Defaults to Wallpaper.

Returns

Wallpaper[]

The registered wallpapers.