Table of Contents

Class Session<TUniverse>

Namespace
AlphaFramework.World
Assembly
AlphaFramework.World.dll

A common base for game sessions (i.e. a game actually being played).

public class Session<TUniverse> where TUniverse : class, IUniverse

Type Parameters

TUniverse

The specific type of IUniverse stored in the session.

Inheritance
object
Session<TUniverse>
Derived

Constructors

Session()

Base-constructor for XML serialization. Do not call manually!

public Session()

Session(TUniverse)

Creates a new game session based upon a given universe

public Session(TUniverse baseUniverse)

Parameters

baseUniverse TUniverse

The universe to base the new game session on.

Properties

MapSourceFile

The filename of the map file the Universe was loaded from.

public string? MapSourceFile { get; set; }

Property Value

string

TimeWarpFactor

The factor by which GameTime progression should be multiplied in relation to real time.

public double TimeWarpFactor { get; set; }

Property Value

double

Universe

The current state of the game world.

[LuaHide]
public TUniverse Universe { get; set; }

Property Value

TUniverse

Methods

Load(string)

Loads a Session<TUniverse> from a compressed XML file (savegame).

public static Session<TUniverse> Load(string path)

Parameters

path string

The file to load from.

Returns

Session<TUniverse>

Exceptions

IOException

A problem occurred while reading the file.

UnauthorizedAccessException

Read access to the file is not permitted.

InvalidOperationException

A problem occurred while deserializing the XML data.

Load<TSession>(string)

Loads a Session<TUniverse> from a compressed XML file (savegame).

protected static TSession Load<TSession>(string path) where TSession : Session<TUniverse>

Parameters

path string

The file to load from.

Returns

TSession

Type Parameters

TSession

Exceptions

IOException

A problem occurred while reading the file.

UnauthorizedAccessException

Read access to the file is not permitted.

InvalidOperationException

A problem occurred while deserializing the XML data.

Save(string)

Saves this session in an XML file (savegame).

public virtual void Save(string path)

Parameters

path string

The file to save in.

Exceptions

IOException

A problem occurred while writing the file.

UnauthorizedAccessException

Write access to the file is not permitted.

Update(double)

Updates the underlying Universe.

public virtual double Update(double elapsedRealTime)

Parameters

elapsedRealTime double

How much real time in seconds has elapsed since this method was last called.

Returns

double

The elapsed game time (real time multiplied by TimeWarpFactor)