Search Results for

    Show / Hide Table of Contents

    Class SaveHandler

    A utility class used by the game for various actions and information related to saving and loading.

    Inheritance
    System.Object
    SaveHandler
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: TinyLife
    Assembly: Tiny Life.dll
    Syntax
    public static class SaveHandler

    Methods

    CreateSerializer(EventHandler<ErrorEventArgs>)

    Creates a new Newtonsoft.Json.JsonSerializer that uses the Newtonsoft.Json.JsonSerializerSettings returned in CreateSerializerSettings(EventHandler<ErrorEventArgs>).

    Declaration
    public static JsonSerializer CreateSerializer(EventHandler<ErrorEventArgs> errorHandler)
    Parameters
    Type Name Description
    System.EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> errorHandler

    An optional error handler.

    Returns
    Type Description
    Newtonsoft.Json.JsonSerializer

    A new Newtonsoft.Json.JsonSerializer with some default values set.

    CreateSerializerSettings(EventHandler<ErrorEventArgs>)

    Creates a new instance of Newtonsoft.Json.JsonSerializerSettings, initialized to some default values for saving and loading Map and, specifically, MapObject instances. Additionally, an errorHandler can optionally be attached to determine what should happen when a serialization error occurs.

    Declaration
    public static JsonSerializerSettings CreateSerializerSettings(EventHandler<ErrorEventArgs> errorHandler)
    Parameters
    Type Name Description
    System.EventHandler<Newtonsoft.Json.Serialization.ErrorEventArgs> errorHandler

    An optional error handler.

    Returns
    Type Description
    Newtonsoft.Json.JsonSerializerSettings

    A new instance of Newtonsoft.Json.JsonSerializerSettings with some default values set.

    GetGameDir()

    Returns a System.IO.DirectoryInfo that points to the game's data directory. For more information on where this directory is stored, see https://docs.tinylifegame.com/articles/game_dir.html.

    Declaration
    public static DirectoryInfo GetGameDir()
    Returns
    Type Description
    System.IO.DirectoryInfo

    The game's data directory.

    GetSaveDir(String)

    Returns a System.IO.DirectoryInfo that points to the directory that a save with the given name is or would be stored in. This method returns a subdirectory of GetSavesDir().

    Declaration
    public static DirectoryInfo GetSaveDir(string name)
    Parameters
    Type Name Description
    System.String name
    Returns
    Type Description
    System.IO.DirectoryInfo

    The directory for the given save.

    GetSavesDir()

    Returns a System.IO.DirectoryInfo that points to the game's saves directory. This method returns a subdirectory of GetGameDir().

    Declaration
    public static DirectoryInfo GetSavesDir()
    Returns
    Type Description
    System.IO.DirectoryInfo

    The game's saves directory.

    Events

    OnGameLoaded

    An event that is raised before and after the game is loaded.

    Declaration
    public static event Action<GameImpl, EventPhase> OnGameLoaded
    Event Type
    Type Description
    System.Action<GameImpl, EventPhase>

    OnGameSaved

    An event that is raised before and after the game is saved.

    Declaration
    public static event Action<GameImpl, EventPhase> OnGameSaved
    Event Type
    Type Description
    System.Action<GameImpl, EventPhase>
    ☀
    ☾
    In This Article
    Back to top
    © 2021-2022 Ellpeck – Impressum – Privacy – Status
    ☀
    ☾