Hex Terrains Framework
Search Results for

    Show / Hide Table of Contents

    Class HexTerrainSerializer

    HexTerrainSerializer is a static class that provides methods to serialize and deserialize HexTerrain data entity.

    Inheritance
    object
    HexTerrainSerializer
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Fwt.HexTerrains
    Assembly: fwt.hexterrains.dll
    Syntax
    public static class HexTerrainSerializer

    Fields

    Version

    Version of the serializer. Used for backward compatibility. Will be incremented when changes are added to the serialization/deserialization process.

    Declaration
    public static int Version
    Field Value
    Type Description
    int

    Methods

    Deserialize(BinaryReader, Entity, EntityManager, CustomDeserializerCallback)

    Deserializes the terrain entity from a binary reader.

    Declaration
    public static bool Deserialize(BinaryReader reader, Entity terrainEntity, EntityManager entityManager, HexTerrainSerializer.CustomDeserializerCallback customDeserializer)
    Parameters
    Type Name Description
    BinaryReader reader

    binary reader that deserializes a terrain data

    Entity terrainEntity
    EntityManager entityManager

    entity manager from the world the terrain entity lives

    HexTerrainSerializer.CustomDeserializerCallback customDeserializer

    If provided, this function is called to give the user an ability to insert their own load data layer logic

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    Deserialize(Stream, Entity, EntityManager, CustomDeserializerCallback)

    Deserializes the terrain entity from a stream.

    Declaration
    public static bool Deserialize(Stream stream, Entity terrainEntity, EntityManager entityManager, HexTerrainSerializer.CustomDeserializerCallback customDeserializer)
    Parameters
    Type Name Description
    Stream stream

    stream to deserialize data from

    Entity terrainEntity
    EntityManager entityManager

    entity manager from the world the terrain entity lives

    HexTerrainSerializer.CustomDeserializerCallback customDeserializer

    If provided, this function is called to give the user an ability to insert their own load data layer logic

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    LoadTerrainFromFile(byte[], Entity, EntityManager, CustomDeserializerCallback)

    Loads the terrain entity from a byte array.

    Declaration
    public static bool LoadTerrainFromFile(byte[] byteArray, Entity terrainEntity, EntityManager entityManager, HexTerrainSerializer.CustomDeserializerCallback customDeserializer)
    Parameters
    Type Name Description
    byte[] byteArray

    Byte array with serialized terrain

    Entity terrainEntity

    entity to put the extracted data on

    EntityManager entityManager

    entity manager from the world the terrain entity lives

    HexTerrainSerializer.CustomDeserializerCallback customDeserializer

    If provided, this function is called to give the user an ability to insert their own load data layer logic

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    LoadTerrainFromFile(string, Entity, EntityManager, CustomDeserializerCallback)

    Loads the terrain entity from a file.

    Declaration
    public static bool LoadTerrainFromFile(string fileName, Entity terrainEntity, EntityManager entityManager, HexTerrainSerializer.CustomDeserializerCallback customDeserializer)
    Parameters
    Type Name Description
    string fileName

    full file path

    Entity terrainEntity

    entity to put the extracted data on

    EntityManager entityManager

    entity manager from the world the terrain entity lives

    HexTerrainSerializer.CustomDeserializerCallback customDeserializer

    If provided, this function is called to give the user an ability to insert their own load data layer logic

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    ReadTerrainSettings(BinaryReader, int)

    Reads the terrain settings from a binary reader.

    Declaration
    public static HexTerrainSettings ReadTerrainSettings(BinaryReader reader, int version)
    Parameters
    Type Name Description
    BinaryReader reader

    binary reader that deserializes a terrain data

    int version
    Returns
    Type Description
    HexTerrainSettings

    deserialized terrain settings

    ReadVersion1(BinaryReader, Entity, EntityManager, HexTerrainSettings, CustomDeserializerCallback)

    Reads the terrain entity data from a binary reader. Called if the data was saved by a Serializer of version 1 or more.

    Declaration
    public static bool ReadVersion1(BinaryReader reader, Entity terrainEntity, EntityManager entityManager, HexTerrainSettings terrainSettings, HexTerrainSerializer.CustomDeserializerCallback customDeserializer)
    Parameters
    Type Name Description
    BinaryReader reader

    binary reader that deserializes a terrain data

    Entity terrainEntity
    EntityManager entityManager

    entity manager from the world the terrain entity lives

    HexTerrainSettings terrainSettings

    Deserialized settings of the terrain that is being deserialized

    HexTerrainSerializer.CustomDeserializerCallback customDeserializer

    If provided, this function is called to give the user an ability to insert their own load data layer logic

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    SaveTerrainToFile(string, Entity, EntityManager, CustomSerializerCallback)

    Saves the terrain entity to a file.

    Declaration
    public static bool SaveTerrainToFile(string filePath, Entity terrainEntity, EntityManager entityManager, HexTerrainSerializer.CustomSerializerCallback customSerializer)
    Parameters
    Type Name Description
    string filePath

    full path to the file

    Entity terrainEntity

    terrain entity to save

    EntityManager entityManager

    entity manager from the world the terrain entity lives

    HexTerrainSerializer.CustomSerializerCallback customSerializer

    If provided, this function is called to give the user an ability to insert their own save data layer logic

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    Serialize(BinaryWriter, Entity, EntityManager, CustomSerializerCallback)

    Serializes the terrain entity using a binary writer

    Declaration
    public static bool Serialize(BinaryWriter writer, Entity terrainEntity, EntityManager entityManager, HexTerrainSerializer.CustomSerializerCallback customSerializer)
    Parameters
    Type Name Description
    BinaryWriter writer

    binary writer that serializes the terrain data

    Entity terrainEntity

    terrain entity to serialize

    EntityManager entityManager

    entity manager from the world the terrain entity lives

    HexTerrainSerializer.CustomSerializerCallback customSerializer

    If provided, this function is called to give the user an ability to insert their own save data layer logic

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    Serialize(Stream, Entity, EntityManager, CustomSerializerCallback)

    Serializes the terrain entity to a stream.

    Declaration
    public static bool Serialize(Stream stream, Entity terrainEntity, EntityManager entityManager, HexTerrainSerializer.CustomSerializerCallback customSerializer)
    Parameters
    Type Name Description
    Stream stream

    stream to serialize an entity into

    Entity terrainEntity

    terrain entity to serialize

    EntityManager entityManager

    entity manager from the world the terrain entity lives

    HexTerrainSerializer.CustomSerializerCallback customSerializer

    If provided, this function is called to give the user an ability to insert their own save data layer logic

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    WriteTerrainSettings(HexTerrainSettings, BinaryWriter)

    Writes the terrain settings to the binary writer.

    Declaration
    public static bool WriteTerrainSettings(HexTerrainSettings terrainSettings, BinaryWriter writer)
    Parameters
    Type Name Description
    HexTerrainSettings terrainSettings

    terrain settings to write

    BinaryWriter writer

    binary writer that serializes the terrain

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    WriteTypeHash(BinaryWriter, ComponentType)

    Writes the type hash of the component type to the binary writer.

    Declaration
    public static void WriteTypeHash(BinaryWriter writer, ComponentType componentType)
    Parameters
    Type Name Description
    BinaryWriter writer

    binary writer that serializes the terrain data

    ComponentType componentType

    type of the component data that is being serialized

    WriteVersion1(BinaryWriter, Entity, EntityManager, CustomSerializerCallback)

    Writes the terrain entity data to a binary writer. Called if the Serializer version is 1 or more.

    Declaration
    public static bool WriteVersion1(BinaryWriter writer, Entity terrainEntity, EntityManager entityManager, HexTerrainSerializer.CustomSerializerCallback customSerializer)
    Parameters
    Type Name Description
    BinaryWriter writer

    binary writer that serializes the terrain data

    Entity terrainEntity

    terrain entity to serialize

    EntityManager entityManager

    entity manager from the world the terrain entity lives

    HexTerrainSerializer.CustomSerializerCallback customSerializer

    If provided, this function is called to give the user an ability to insert their own save data layer logic

    Returns
    Type Description
    bool

    true if successfull, otherwise - false

    In this article
    Back to top Generated by DocFX