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, IReadOnlyDictionary<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, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, WallMode wallMode, int price, ColorScheme color, float lightPour, Func<OpeningType, int[], WallLike, Opening> construct = null, TextureRegion icon = null)
Parameters
namestringtexturesIReadOnlyDictionary<Point, TextureRegion>textureRegionPointwallModeWallModepriceintcolorColorSchemelightPourfloatconstructFunc<OpeningType, int[], WallLike, Opening>iconTextureRegion
OpeningType(string, IReadOnlyDictionary<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, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, WallMode wallMode, int price, ColorScheme[] colors, float lightPour, Func<OpeningType, int[], WallLike, Opening> construct = null, TextureRegion icon = null)
Parameters
namestringtexturesIReadOnlyDictionary<Point, TextureRegion>textureRegionPointwallModeWallModepriceintcolorsColorScheme[]lightPourfloatconstructFunc<OpeningType, int[], WallLike, Opening>iconTextureRegion
OpeningType(string, IReadOnlyDictionary<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, IReadOnlyDictionary<Point, TextureRegion> textures, Point textureRegion, WallMode wallMode, int price, ColorSettings colors, float lightPour, Func<OpeningType, int[], WallLike, Opening> construct = null, TextureRegion icon = null)
Parameters
namestringThe name
texturesIReadOnlyDictionary<Point, TextureRegion>The texture atlas to use for rendering
textureRegionPointThe texture region to use for rendering
wallModeWallModeThe wall mode
priceintThe price
colorsColorSettingsThe color schemes for this opening
lightPourfloatA value between 0 and 1 that determines how much light, pours into a Room through an opening of this type, where 1 implies that the wall is almost entirely open when this opening type is applied, and 0 implies that the opening has almost no transparency to it.
constructFunc<OpeningType, int[], WallLike, Opening>The function that is used for constructing an Opening from this opening type
iconTextureRegionThe 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
A value between 0 and 1 that determines how much light, pours into a Room through an opening of this type, where 1 implies that the wall is almost entirely open when this opening type is applied, and 0 implies that the opening has almost no transparency to it.
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
AllowedWallType
public Type AllowedWallType { get; init; }
Property Value
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
timeGameTimeThe game's time
batchSpriteBatchThe sprite batch to render with
mapMapThe map.
pos1PointThe first position in the Positions array.
pos2PointThe second position in the Positions array.
floorintThe floor.
drawPosVector2The position, in screen space, to draw at
verticalboolWhether the underlying wall is vertical
scalefloatThe scale to render with
colorsint[]The color indices that should be used for rendering
overrideColorColor?A color that this object should be rendered with, instead of its default color
depthOffsetfloatAn offset that is optionally added to the draw depth.
textureOffsetPointAn 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
eElementThe ui element to draw this opening onto
batchSpriteBatchThe sprite batch to use for drawing
timeGameTimeThe game time
mapMapThe map.
colorsint[]The color indices to draw with
drawScalefloatThe 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
typeOpeningTypeThe type to register
Returns
- OpeningType
The passed
type, for chaining.