TinyLifeExampleMod/Api/TinyLife/World/Wallpaper.md

46 lines
4.1 KiB
Markdown

# [Wallpaper](./Wallpaper.md)
Namespace: [TinyLife]() > [World]()
Assembly: Tiny Life.dll
Implements [IPricedObject](./IPricedObject.md)
## Summary
A wallpaper is a single-instanced object that can be attached to a `TinyLife.World.Wall`, which makes the wall render a different texture. To register custom wallpapers, use `TinyLife.World.Wallpaper.Register(System.String,System.Int32,MLEM.Textures.UniformTextureAtlas,Microsoft.Xna.Framework.Point,TinyLife.Utilities.ColorScheme,MLEM.Textures.TextureRegion)`. Note that registered wallpapers need to use a texture generated by `TinyLife.Utilities.TextureHandler.ApplyWallpaperMasks(Microsoft.Xna.Framework.Graphics.Texture2D,System.Int32,System.Int32,System.Action{MLEM.Textures.UniformTextureAtlas})`.
## Fields
| Type | Name | Summary |
| --- | --- | --- |
| [String](https://docs.microsoft.com/en-us/dotnet/api/System.String) | BaseName | The name of this type of wallpaper. Whereas `TinyLife.World.Wallpaper.Name` has the index of its `TinyLife.World.Wallpaper.color` appended to it, this one is just the type's name. |
| [ColorScheme](./../Utilities/ColorScheme.md) | ColorScheme | The `TinyLife.World.Wallpaper.ColorScheme` that this wallpaper type uses |
| [TextureRegion](./Wallpaper.md) | 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. |
| [String](https://docs.microsoft.com/en-us/dotnet/api/System.String) | Name | The name of this specific wallpaper. This is comprised of the `TinyLife.World.Wallpaper.BaseName` with the `TinyLife.World.Wallpaper.color`'s index attached to it. |
| [Int32](https://docs.microsoft.com/en-us/dotnet/api/System.Int32) | Price | The price of this wallpaper. Can be retrieved easily using `TinyLife.World.Wallpaper.GetPrice`. |
## Methods
| Return | Name | Summary |
| --- | --- | --- |
| void | Draw ( [`GameTime`](./Wallpaper.md), [`SpriteBatch`](./Wallpaper.md), [`Vector2`](./Wallpaper.md), [`WallMode`](./WallMode.md), [`Boolean`](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean), [`Boolean`](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean), [`Single`](https://docs.microsoft.com/en-us/dotnet/api/System.Single), [`Single`](https://docs.microsoft.com/en-us/dotnet/api/System.Single), [`Boolean`](https://docs.microsoft.com/en-us/dotnet/api/System.Boolean) ) | Draws this wallpaper on the given wall with the given data. |
| void | DrawUi ( [`Element`](./Wallpaper.md), [`SpriteBatch`](./Wallpaper.md), [`GameTime`](./Wallpaper.md), [`Single`](https://docs.microsoft.com/en-us/dotnet/api/System.Single) ) | Draws this wallpaper on the given `MLEM.Ui.Elements.Element` in ui space |
| [Single](https://docs.microsoft.com/en-us/dotnet/api/System.Single) | GetPrice ( ) | |
## Static Fields
| Type | Name | Summary |
| --- | --- | --- |
| [IDictionary](https://docs.microsoft.com/en-us/dotnet/api/System.Collections.Generic.IDictionary-2)\<[String](https://docs.microsoft.com/en-us/dotnet/api/System.String), [Wallpaper](./Wallpaper.md)[]> | Wallpapers | The registry for all `TinyLife.World.Wallpaper` objects in the game and mods. Use `TinyLife.World.Wallpaper.Register(System.String,System.Int32,MLEM.Textures.UniformTextureAtlas,Microsoft.Xna.Framework.Point,TinyLife.Utilities.ColorScheme,MLEM.Textures.TextureRegion)` to register custom wallpapers. |
## Static Methods
| Return | Name | Summary |
| --- | --- | --- |
| void | Register ( [`String`](https://docs.microsoft.com/en-us/dotnet/api/System.String), [`Int32`](https://docs.microsoft.com/en-us/dotnet/api/System.Int32), [`UniformTextureAtlas`](./Wallpaper.md), [`Point`](./Wallpaper.md), [`ColorScheme`](./../Utilities/ColorScheme.md), [`TextureRegion`](./Wallpaper.md) ) | Creates and registers a new wallpaper with the given settings. Note that the `` should be one generated using `TinyLife.Utilities.TextureHandler.ApplyWallpaperMasks(Microsoft.Xna.Framework.Graphics.Texture2D,System.Int32,System.Int32,System.Action{MLEM.Textures.UniformTextureAtlas})`, as otherwise, graphical issues will occur. |