Class RoofType
A roof type stores settings and configurations for Roof instances. To register a new roof type, use Register(RoofType).
[JsonConverter(typeof(MigratingStaticJsonConverter<RoofType>), new object[] { typeof(RoofType), "PrivateTypes", true })]
public class RoofType
- Inheritance
-
RoofType
- Inherited Members
- Extension Methods
Constructors
RoofType(string, int, ColorScheme, RoofStyle, IReadOnlyDictionary<Point, TextureRegion>, Point, TextureRegion)
Creates a new roof type with the given settings
public RoofType(string name, int price, ColorScheme color, RoofStyle style, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, TextureRegion icon = null)
Parameters
namestringThe name that this roof type should have
priceintThe price for a 1x1 area of this roof type
colorColorSchemeThe color scheme that this roof type can have
styleRoofStyleThe RoofStyle that this roof has
texturesIReadOnlyDictionary<Point, TextureRegion>The textures that the
textureRegionshould read from.textureRegionPointThe initial, top-left texture region of this roof, which will be gathered from
textures.iconTextureRegionThe icon that this roof should have in build mode
RoofType(string, int, ColorScheme[], RoofStyle, IReadOnlyDictionary<Point, TextureRegion>, Point, TextureRegion)
Creates a new roof type with the given settings
public RoofType(string name, int price, ColorScheme[] colors, RoofStyle style, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, TextureRegion icon = null)
Parameters
namestringThe name that this roof type should have
priceintThe price for a 1x1 area of this roof type
colorsColorScheme[]The color scheme that this roof type can have
styleRoofStyleThe RoofStyle that this roof has
texturesIReadOnlyDictionary<Point, TextureRegion>The textures that the
textureRegionshould read from.textureRegionPointThe initial, top-left texture region of this roof, which will be gathered from
textures.iconTextureRegionThe icon that this roof should have in build mode
RoofType(string, int, ColorSettings, RoofStyle, IReadOnlyDictionary<Point, TextureRegion>, Point, TextureRegion)
Creates a new roof type with the given settings
public RoofType(string name, int price, ColorSettings colors, RoofStyle style, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, TextureRegion icon = null)
Parameters
namestringThe name that this roof type should have
priceintThe price for a 1x1 area of this roof type
colorsColorSettingsThe color scheme that this roof type can have
styleRoofStyleThe RoofStyle that this roof has
texturesIReadOnlyDictionary<Point, TextureRegion>The textures that the
textureRegionshould read from.textureRegionPointThe initial, top-left texture region of this roof, which will be gathered from
textures.iconTextureRegionThe icon that this roof should have in build mode
Fields
Colors
The color settings that this roof uses.
public readonly ColorSettings Colors
Field Value
FlatSheetMetal
public static readonly RoofType FlatSheetMetal
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
ModernFlat
public static readonly RoofType ModernFlat
Field Value
Name
The name of this roof type, which is used to store it to disk
public readonly string Name
Field Value
OldStyleFlat
public static readonly RoofType OldStyleFlat
Field Value
Price
The price of a 1x1 rectangle of this roof type
public readonly int Price
Field Value
RoundedShingles
public static readonly RoofType RoundedShingles
Field Value
SheetMetal
public static readonly RoofType SheetMetal
Field Value
SquareShingles
public static readonly RoofType SquareShingles
Field Value
Style
The RoofStyle that this roof has. If Draw(GameTime, SpriteBatch, Map, Rectangle, int, Direction2, int[], Wallpaper, int, float, Color?, bool) has completely custom behavior, the roof style is ignored, but can be set to Custom to signal this behavior to other mods.
public readonly RoofStyle Style
Field Value
TextureRegion
The initial, top-left texture region of this roof, which will be gathered from Textures.
public readonly Point TextureRegion
Field Value
- Point
Textures
The textures that the TextureRegion should read from.
public readonly IReadOnlyDictionary<Point, TextureRegion> Textures
Field Value
- IReadOnlyDictionary<Point, TextureRegion>
Thatch
public static readonly RoofType Thatch
Field Value
Types
A registry of all of the RoofType instances that are currently registered
public static readonly ReadOnlyDictionary<string, RoofType> Types
Field Value
Methods
Draw(GameTime, SpriteBatch, Map, Rectangle, int, Direction2, int[], Wallpaper, int, float, Color?, bool)
Draws the given Roof in world space
public virtual void Draw(GameTime time, SpriteBatch batch, Map map, Rectangle area, int floor, Direction2 rotation, int[] colorIndices, Wallpaper wallpaper, int roofHeightOffset, float depthOffset = 0, Color? overrideColor = null, bool isInWorld = true)
Parameters
timeGameTimeThe game's current time
batchSpriteBatchThe sprite batch to use for drawing
mapMapThe map to draw on
areaRectangleThe area the roof covers
floorintThe floor the roof is on.
rotationDirection2The roof's rotation
colorIndicesint[]The color indices in this roof's Colors.
wallpaperWallpaperThe wallpaper applied to the roof
roofHeightOffsetintAn offset that is added onto the GetGableOffset(Rectangle, Direction2, Point) for the roof.
depthOffsetfloatThe value that should be added to the depth of this roof
overrideColorColor?An override color that should be used instead of this roof's color, or null to use the roof's color.
isInWorldboolWhether this roof is currently in the world (or being drawn as a preview).
DrawUi(SpriteBatch, Element, int[], float)
Draws a Roof in ui space, only drawing a 1x1 area of it
public virtual void DrawUi(SpriteBatch batch, Element element, int[] colorIndices, float drawScale)
Parameters
batchSpriteBatchThe sprite batch to use for drawing
elementElementThe element to draw the roof on
colorIndicesint[]The color indices in this roof's Colors.
drawScalefloatThe scale to draw the roof with
GetGableOffset(Rectangle, Direction2, Point)
Returns the gable offset that Furniture attached to this roof should be displayed with. By default, this method returns an offset for roofs with the GableStyle.
public virtual int GetGableOffset(Rectangle area, Direction2 rotation, Point innerPos)
Parameters
areaRectangleThe area that the roof covers.
rotationDirection2The roof's rotation.
innerPosPointThe position in the roof's
areathat the object sits on.
Returns
- int
The gable offset that this roof should have, in half tiles.
GetPrice(Rectangle)
Returns the price of this roof type for the given area. This returns Price, multiplied by the area's size.
public virtual int GetPrice(Rectangle area)
Parameters
areaRectangleThe area of roofing to get the price for
Returns
- int
The price of the area
Register(RoofType)
Registers a new roof type with the given settings into the Types registry
public static RoofType Register(RoofType type)
Parameters
typeRoofTypeThe roof type to register
Returns
- RoofType
The roof type passed, for chaining