Class HexTerrainLayerGroup
Base class for HexTerrain layer that holds a list of Terrain layers inside. Inherit from this class to create a list of terrain layers following the standard HexTerrain layers structure.
Inherited Members
Namespace: Fwt.HexTerrains.Data
Assembly: fwt.hexterrains.dll
Syntax
public abstract class HexTerrainLayerGroup : HexTerrainLayer, IDisposable, ISerializableTerrainLayer
Methods
DeserializeLayer(BinaryReader, HexTerrainSettings)
Requests a deserialization of the layer data. Returns false if the layer does not support deserialization.
Declaration
public abstract bool DeserializeLayer(BinaryReader reader, HexTerrainSettings terrainSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryReader | reader | binary reader to deserialize data from |
| HexTerrainSettings | terrainSettings | deserialized terrain settings (layer was serialized with this settings) |
Returns
| Type | Description |
|---|---|
| bool |
GetLayer<TTargetLayer>()
Returns the first layer of type TTargetLayer.
Declaration
public abstract TTargetLayer GetLayer<TTargetLayer>()
Returns
| Type | Description |
|---|---|
| TTargetLayer | first found layer of TTargetLayer type. If not found, returns null |
Type Parameters
| Name | Description |
|---|---|
| TTargetLayer | type of layer to find |
GetLayer<TTargetLayer>(HexTerrainLayerReference)
Returns the layer of type TTargetLayer from the list of layers according to the provided arguments.
Declaration
public abstract TTargetLayer GetLayer<TTargetLayer>(HexTerrainLayerReference args) where TTargetLayer : HexTerrainLayer
Parameters
| Type | Name | Description |
|---|---|---|
| HexTerrainLayerReference | args | args to get layer according to |
Returns
| Type | Description |
|---|---|
| TTargetLayer | layer of TTargetType according to provided arguments |
Type Parameters
| Name | Description |
|---|---|
| TTargetLayer | casts result to this type |
GetLayer<TTargetLayer>(int)
Returns the layer of type TTargetLayer at the specified index.
Declaration
public abstract TTargetLayer GetLayer<TTargetLayer>(int layerIndex)
Parameters
| Type | Name | Description |
|---|---|---|
| int | layerIndex | index at which to get a layer |
Returns
| Type | Description |
|---|---|
| TTargetLayer | layer of TTargetType at the requested index (if found) or null (if not found) |
Type Parameters
| Name | Description |
|---|---|
| TTargetLayer | casts result to this type |
GetLayer<TTargetLayer>(int, bool, string, bool)
Retrieves a terrain layer of the specified type using either its index or name, depending on the provided search options.
Declaration
public abstract TTargetLayer GetLayer<TTargetLayer>(int layerIndex, bool isSearchByIndex, string layerName, bool isSearchByName) where TTargetLayer : HexTerrainLayer
Parameters
| Type | Name | Description |
|---|---|---|
| int | layerIndex | The zero-based index of the layer to retrieve. Used if |
| bool | isSearchByIndex | Indicates whether to search for the layer by its index. If true, |
| string | layerName | The name of the layer to retrieve. Used if |
| bool | isSearchByName | Indicates whether to search for the layer by its name. If true, |
Returns
| Type | Description |
|---|---|
| TTargetLayer | The terrain layer of type |
Type Parameters
| Name | Description |
|---|---|
| TTargetLayer | The type of terrain layer to retrieve. Must derive from HexTerrainLayer. |
Remarks
If both isSearchByIndex and isSearchByName are
true, the method may prioritize one search method over the other depending on the
implementation. Ensure that the provided index and name correspond to an existing layer to avoid a null result.
GetLayer<TTargetLayer>(int, string)
Returns the layer of type TTargetLayer at the specified index and with the specified name.
Declaration
public abstract TTargetLayer GetLayer<TTargetLayer>(int layerIndex, string layerName) where TTargetLayer : HexTerrainLayer
Parameters
| Type | Name | Description |
|---|---|---|
| int | layerIndex | index at which to get a layer |
| string | layerName | name of the layer that should be found |
Returns
| Type | Description |
|---|---|
| TTargetLayer | layer of TTargetType at the requested index (if found) if it has the provided name |
Type Parameters
| Name | Description |
|---|---|
| TTargetLayer | casts result to this type |
GetLayer<TTargetLayer>(string)
Returns the layer of type TTargetLayer at the specified index.
Declaration
public abstract TTargetLayer GetLayer<TTargetLayer>(string layerName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | layerName | name of the layer that should be found |
Returns
| Type | Description |
|---|---|
| TTargetLayer | layer of TTargetType at the requested index (if found) or null (if not found) |
Type Parameters
| Name | Description |
|---|---|
| TTargetLayer | casts result to this type |
SerializeLayer(BinaryWriter)
Requests a serialization of the layer data. Returns false if the layer does not support serialization.
Declaration
public abstract bool SerializeLayer(BinaryWriter writer)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryWriter | writer | binary writer to serialize data by |
Returns
| Type | Description |
|---|---|
| bool | True if serialized, false if not serialized/not supported/not implemented |