Class OpeningType
An opening is some sort of extrusion in a WallLike, like a window or a door. An opening type stores data that can be used to construct a Opening instance.
[JsonConverter(typeof(MigratingStaticJsonConverter<OpeningType>), new object[] { typeof(OpeningType), "PrivateTypes", true })]
public class OpeningType
- Inheritance
-
OpeningType
- Inherited Members
- Extension Methods
Constructors
OpeningType(string, Dictionary<Point, TextureRegion>, Point, WallMode, int, ColorScheme, float, Func<OpeningType, int[], WallLike, Opening>, TextureRegion)
Creates a new opening type with the given settings.
public OpeningType(string name, Dictionary<Point, TextureRegion> textures, Point textureRegion, WallMode wallMode, int price, ColorScheme color, float lightPour, Func<OpeningType, int[], WallLike, Opening> construct = null, TextureRegion icon = null)
Parameters
name
stringtextures
Dictionary<Point, TextureRegion>textureRegion
PointwallMode
WallModeprice
intcolor
ColorSchemelightPour
floatconstruct
Func<OpeningType, int[], WallLike, Opening>icon
TextureRegion
OpeningType(string, Dictionary<Point, TextureRegion>, Point, WallMode, int, ColorScheme[], float, Func<OpeningType, int[], WallLike, Opening>, TextureRegion)
Creates a new opening type with the given settings.
public OpeningType(string name, Dictionary<Point, TextureRegion> textures, Point textureRegion, WallMode wallMode, int price, ColorScheme[] colors, float lightPour, Func<OpeningType, int[], WallLike, Opening> construct = null, TextureRegion icon = null)
Parameters
name
stringtextures
Dictionary<Point, TextureRegion>textureRegion
PointwallMode
WallModeprice
intcolors
ColorScheme[]lightPour
floatconstruct
Func<OpeningType, int[], WallLike, Opening>icon
TextureRegion
OpeningType(string, Dictionary<Point, TextureRegion>, Point, WallMode, int, ColorSettings, float, Func<OpeningType, int[], WallLike, Opening>, TextureRegion)
Creates a new opening type with the given settings
public OpeningType(string name, Dictionary<Point, TextureRegion> textures, Point textureRegion, WallMode wallMode, int price, ColorSettings colors, float lightPour, Func<OpeningType, int[], WallLike, Opening> construct = null, TextureRegion icon = null)
Parameters
name
stringThe name
textures
Dictionary<Point, TextureRegion>The texture atlas to use for rendering
textureRegion
PointThe texture region to use for rendering
wallMode
WallModeThe wall mode
price
intThe price
colors
ColorSettingsThe color schemes for this opening
lightPour
floatconstruct
Func<OpeningType, int[], WallLike, Opening>The function that is used for constructing an Opening from this opening type
icon
TextureRegionThe build mode category icon of this object
Fields
Colors
The color settings that this opening uses.
public readonly ColorSettings Colors
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
LightPour
public readonly float LightPour
Field Value
Name
The name of this opening type
public readonly string Name
Field Value
Price
The price of this opening
public readonly int Price
Field Value
Types
A registry for all OpeningType instances from the game and mods. Use Register(OpeningType) to register custom opening types.
public static readonly ReadOnlyDictionary<string, OpeningType> Types
Field Value
WallMode
public readonly WallMode WallMode
Field Value
Properties
CanBuy
A field that indicates whether this opening type can be bought without the "ShowNonBuyable" cheat enabled
public bool CanBuy { get; init; }
Property Value
Migrations
The set of migrations that should be applied to instances of this opening type when they are loaded from disk.
public List<Migration<Opening>> Migrations { get; init; }
Property Value
Methods
Construct(int[], WallLike)
Constructs a new Opening instance from this opening type
public Opening Construct(int[] colors, WallLike wall)
Parameters
Returns
- Opening
A new opening instance based on this type
Draw(GameTime, SpriteBatch, Map, Point, Point, int, Vector2, bool, float, int[], Color?, float, Point)
Draws this opening in a wall
public void Draw(GameTime time, SpriteBatch batch, Map map, Point pos1, Point pos2, int floor, Vector2 drawPos, bool vertical, float scale, int[] colors, Color? overrideColor, float depthOffset = 0, Point textureOffset = default)
Parameters
time
GameTimeThe game's time
batch
SpriteBatchThe sprite batch to render with
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 space, to draw at
vertical
boolWhether the underlying wall is vertical
scale
floatThe scale to render with
colors
int[]The color indices that should be used for rendering
overrideColor
Color?A color that this object should be rendered with, instead of its default color
depthOffset
floatAn offset that is optionally added to the draw depth.
textureOffset
PointAn offset that should be applied to the texture region. This value is multiplied with the texture region's size.
DrawUi(Element, SpriteBatch, GameTime, Map, int[], float)
Draws this opening in ui space rather than world space
public void DrawUi(Element e, SpriteBatch batch, GameTime time, Map map, int[] colors, float drawScale)
Parameters
e
ElementThe ui element to draw this opening onto
batch
SpriteBatchThe sprite batch to use for drawing
time
GameTimeThe game time
map
MapThe map.
colors
int[]The color indices to draw with
drawScale
floatThe scale to draw with. 0.3 by default.
Register(OpeningType)
Registers the given OpeningType to the Types registry
public static OpeningType Register(OpeningType type)
Parameters
type
OpeningTypeThe type to register
Returns
- OpeningType
The passed
type
, for chaining.