Class Wallpaper
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
stringname
stringprice
inttextures
Dictionary<Point, TextureRegion>textureRegion
PointcolorSettings
ColorSettingscolors
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
BigTiles
public static readonly Wallpaper[] BigTiles
Field Value
Cacti
public static readonly Wallpaper[] Cacti
Field Value
ColorSettings
The color settings used by this wallpaper.
public readonly ColorSettings ColorSettings
Field Value
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[]
Default
public static readonly Wallpaper[] Default
Field Value
DoubleTimbered
public static readonly Wallpaper[] DoubleTimbered
Field Value
DoubleTimberedRockBase
public static readonly Wallpaper[] DoubleTimberedRockBase
Field Value
HorizontalWoodenSiding
public static readonly Wallpaper[] HorizontalWoodenSiding
Field Value
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
MismatchedBricks
public static readonly Wallpaper[] MismatchedBricks
Field Value
ModernBricks
public static readonly Wallpaper[] ModernBricks
Field Value
ModernLines
public static readonly Wallpaper[] ModernLines
Field Value
ModernSquares
public static readonly Wallpaper[] ModernSquares
Field Value
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
Price
The price of this wallpaper. Can be retrieved easily using GetPrice().
public readonly int Price
Field Value
Rainbow
public static readonly Wallpaper[] Rainbow
Field Value
RockBase
public static readonly Wallpaper[] RockBase
Field Value
SingleColor
public static readonly Wallpaper[] SingleColor
Field Value
SingleColorBaseboard
public static readonly Wallpaper[] SingleColorBaseboard
Field Value
SingleColorTopBottomBoard
public static readonly Wallpaper[] SingleColorTopBottomBoard
Field Value
SingleColorWoodBottom
public static readonly Wallpaper[] SingleColorWoodBottom
Field Value
SingleTimbered
public static readonly Wallpaper[] SingleTimbered
Field Value
SingleTimberedRockBase
public static readonly Wallpaper[] SingleTimberedRockBase
Field Value
SmallClouds
public static readonly Wallpaper[] SmallClouds
Field Value
Stars
public static readonly Wallpaper[] Stars
Field Value
StripedWood
public static readonly Wallpaper[] StripedWood
Field Value
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>
VerticalStripes
public static readonly Wallpaper[] VerticalStripes
Field Value
VerticalWallTiles
public static readonly Wallpaper[] VerticalWallTiles
Field Value
VerticalWoodenSiding
public static readonly Wallpaper[] VerticalWoodenSiding
Field Value
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
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
GameTimeThe current game time
batch
SpriteBatchThe sprite batch used for rendering
map
MapThe map.
pos1
PointThe first position in the Positions array.
pos2
PointThe second position in the Positions array.
floor
intThe floor.
drawPos
Vector2The position, in screen coordinates, that the wall should be drawn at
mode
WallModeThe WallMode that the wall should be drawn with
isDown
boolWhether or not the wall is rendering with a reduced height
vertical
boolWhether or not the wall is vertical (or horizontal) in the world
scale
floatThe scale that the wall should be rendered with
shadow
boolWhether or not the shadow texture should be applied on top of the texture
depthOffset
floatAn 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
ElementThe element to draw on
batch
SpriteBatchThe batch to draw with
time
GameTimeThe current game time
map
MapThe map.
drawScale
floatThe 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
stringThe name of the wallpaper type
price
intThe 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
PointThe top left texture region of this wallpaper (on the original texture, not the mask)
color
ColorSchemeThe color scheme of the wallpaper.
icon
TextureRegionThe build mode category icon of this object
defaultColor
int?The color that this wallpaper should display with by default in the wallpaper tool.
constructedType
TypeThe Type that should be constructed to create this wallpaper. Defaults to Wallpaper.
Returns
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
stringThe name of the wallpaper type
price
intThe 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
PointThe top left texture region of this wallpaper (on the original texture, not the mask)
colors
ColorScheme[]The color schemes of the wallpaper.
icon
TextureRegionThe build mode category icon of this object
defaultColors
int[]The colosr that this wallpaper should display with by default in the wallpaper tool.
constructedType
TypeThe Type that should be constructed to create this wallpaper. Defaults to Wallpaper.
Returns
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
stringThe name of the wallpaper type
price
intThe 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
PointThe top left texture region of this wallpaper (on the original texture, not the mask)
colorSettings
ColorSettingsThe 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
TextureRegionThe build mode category icon of this object
constructedType
TypeThe Type that should be constructed to create this wallpaper. Defaults to Wallpaper.
Returns
- Wallpaper[]
The registered wallpapers.