Class FenceType
A fence type is a set of underlying, unchanging settinsg for a FenceWall object. Fence types can be registered using Register(FenceType).
[JsonConverter(typeof(MigratingStaticJsonConverter<FenceType>), new object[] { typeof(FenceType), "PrivateTypes", true })]
public class FenceType
- Inheritance
-
FenceType
- Inherited Members
- Extension Methods
Constructors
FenceType(string, float, TextureRegion, Dictionary<Point, TextureRegion>, Point, params ColorScheme[])
Creates a new fence type with the given settings.
public FenceType(string name, float price, TextureRegion icon, Dictionary<Point, TextureRegion> textures, Point textureRegion, params ColorScheme[] colorSchemes)
Parameters
name
stringThe name of this fence type.
price
floatThe price of a single element of this fence type.
icon
TextureRegionThe build mode icon that this fence type optionally uses.
textures
Dictionary<Point, TextureRegion>The texture atlas that this fence type's <see cref="TextureRegion"/> is on.
textureRegion
PointThe texture region on this fence's type <see cref="Textures"/> that marks the base region for this fence type.
colorSchemes
ColorScheme[]The color schemes that each layer of this fence type uses.
FenceType(string, float, TextureRegion, Dictionary<Point, TextureRegion>, Point, ColorSettings)
Creates a new fence type with the given settings.
public FenceType(string name, float price, TextureRegion icon, Dictionary<Point, TextureRegion> textures, Point textureRegion, ColorSettings colors)
Parameters
name
stringThe name of this fence type.
price
floatThe price of a single element of this fence type.
icon
TextureRegionThe build mode icon that this fence type optionally uses.
textures
Dictionary<Point, TextureRegion>The texture atlas that this fence type's <see cref="TextureRegion"/> is on.
textureRegion
PointThe texture region on this fence's type <see cref="Textures"/> that marks the base region for this fence type.
colors
ColorSettingsThe color settings that this fence type uses.
Fields
Colors
The color settings to use for this fence wall.
public readonly ColorSettings Colors
Field Value
Icon
The build mode icon that this fence type optionally uses.
public readonly TextureRegion Icon
Field Value
- TextureRegion
Name
The name of this fence type.
public readonly string Name
Field Value
Price
The price of a single element of this fence type.
public readonly float Price
Field Value
TextureRegion
The texture region on this fence's type Textures that marks the base region for this fence type. Additional regions are gathered to the right of this region.
public readonly Point TextureRegion
Field Value
- Point
Textures
The texture atlas that this fence type's TextureRegion is on.
public readonly Dictionary<Point, TextureRegion> Textures
Field Value
- Dictionary<Point, TextureRegion>
Types
The set of all registered fence types, including vanilla and modded ones.
public static readonly ReadOnlyDictionary<string, FenceType> Types
Field Value
Methods
Draw(GameTime, SpriteBatch, Map, Point, Point, int, Vector2, bool, float, bool, bool, int[], Direction2, Color?)
Draws this fence type at the given location with the given settings.
public virtual void Draw(GameTime time, SpriteBatch batch, Map map, Point pos1, Point pos2, int floor, Vector2 drawPos, bool vertical, float scale, bool hasPoleNeg, bool hasPolePos, int[] colors, Direction2 cameraRotation, Color? overrideColor = null)
Parameters
time
GameTimeThe game time.
batch
SpriteBatchThe sprite batch to use for drawing.
map
MapThe map this fence wall is on.
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 fence wall is vertical.
scale
floatThe scale to draw with.
hasPoleNeg
boolWhether the fence drawn has a pole in the negative direction.
hasPolePos
boolWhether the fence drawn has a pole in the positive direction.
colors
int[]The color indices in this fence type's Colors to draw with.
cameraRotation
Direction2The camera rotation to draw with.
overrideColor
Color?An optional override color to use instead of this fence type's Colors.
DrawUi(Element, SpriteBatch, GameTime, Map, int[], float)
Draws this fence in UI space, based on the position and size of the given MLEM.Ui.Elements.Element.
public virtual void DrawUi(Element e, SpriteBatch batch, GameTime time, Map map, int[] colors, float drawScale)
Parameters
e
ElementThe element to base position and size on.
batch
SpriteBatchThe sprite batch to use for drawing.
time
GameTimeThe game time.
map
MapThe map.
colors
int[]The color indices in this fence type's Colors to draw with.
drawScale
floatThe scale to draw with.
Register(FenceType)
Registers the given fence type into the Types registry and returns it.
public static FenceType Register(FenceType type)
Parameters
type
FenceTypeThe fence type to register.
Returns
- FenceType
The registered fence type
type
.