SaveData

Namespace: Murder.Assets
Assembly: Murder.dll

public class SaveData : GameAsset

Tracks a saved game with all the player status.

Implements: GameAsset

⭐ Constructors

protected SaveData(int slot, float version, BlackboardTracker tracker)

Parameters
slot int
version float
tracker BlackboardTracker

public SaveData()
public SaveData(int slot, float version)

Parameters
slot int
version float

⭐ Properties

_entitiesOnWorldToDestroy

protected readonly Dictionary<TKey, TValue> _entitiesOnWorldToDestroy;

List of all consumed entities throughout the map. Mapped according to: [World guid -> [Entity Guid]]

Returns
Dictionary<TKey, TValue>

BlackboardTracker

public readonly BlackboardTracker BlackboardTracker;

Returns
BlackboardTracker

CanBeCreated

public virtual bool CanBeCreated { get; }

Returns
bool

CanBeDeleted

public virtual bool CanBeDeleted { get; }

Returns
bool

CanBeRenamed

public virtual bool CanBeRenamed { get; }

Returns
bool

CanBeSaved

public virtual bool CanBeSaved { get; }

Returns
bool

CurrentWorld

public T? CurrentWorld { get; }

Returns
T?

DynamicAssets

public Dictionary<TKey, TValue> DynamicAssets { get; private set; }

These are all the dynamic assets within the game session.

Returns
Dictionary<TKey, TValue>

EditorColor

public virtual Vector4 EditorColor { get; }

Returns
Vector4

EditorFolder

public virtual string EditorFolder { get; }

Returns
string

FileChanged

public bool FileChanged { get; public set; }

Returns
bool

FilePath

public string FilePath { get; public set; }

Returns
string

Guid

public Guid Guid { get; protected set; }

Returns
Guid

Icon

public virtual char Icon { get; }

Returns
char

IsStoredInSaveData

public virtual bool IsStoredInSaveData { get; }

Returns
bool

Name

public string Name { get; public set; }

Returns
string

PendingOperation

public Task PendingOperation { get; }

Returns
Task

Rename

public bool Rename { get; public set; }

Returns
bool

SaveDataRelativeDirectoryPath

public string SaveDataRelativeDirectoryPath { get; private set; }

This is save path, used by its assets.

Returns
string

SavedWorlds

public ImmutableDictionary<TKey, TValue> SavedWorlds { get; private set; }

This maps [World Guid -> Saved World Guid] that does not belong to a run and should be persisted.

Returns
ImmutableDictionary<TKey, TValue>

SaveLocation

public virtual string SaveLocation { get; }

Returns
string

SaveName

public string SaveName { get; private set; }

This is the name used in-game, specified by the user.

Returns
string

SaveRelativeDirectoryPath

public string SaveRelativeDirectoryPath { get; private set; }

This is save path, used by its assets.

Returns
string

SaveSlot

public readonly int SaveSlot;

Which save slot this belongs to. Default is zero.

Returns
int

SaveVersion

public readonly float SaveVersion;

Game version, used for game save compatibility.

Returns
float

StoreInDatabase

public virtual bool StoreInDatabase { get; }

Returns
bool

TaggedForDeletion

public bool TaggedForDeletion;

Returns
bool

⭐ Methods

GetOrCreateEntitiesToBeDestroyedAt(World)

protected HashSet<T> GetOrCreateEntitiesToBeDestroyedAt(World world)

Fetch the collected items at . If none, creates a new empty collection and returns that instead.

Parameters
world World

Returns
HashSet<T>

EntityToGuid(World, Entity)

protected T? EntityToGuid(World world, Entity e)

Parameters
world World
e Entity

Returns
T?

EntityToGuid(World, int)

protected T? EntityToGuid(World world, int id)

Parameters
world World
id int

Returns
T?

TryGetDynamicAssetImpl(out T&)

protected virtual bool TryGetDynamicAssetImpl(T& value)

Parameters
value T&

Returns
bool

ClearAllWorlds()

protected virtual void ClearAllWorlds()

This will clean all saved worlds.

OnModified()

protected virtual void OnModified()

HasFinishedSaveWorld()

public bool HasFinishedSaveWorld()

Returns
bool

RecordRemovedEntityFromWorld(World, Entity)

public bool RecordRemovedEntityFromWorld(World world, Entity entity)

This records that an entity has been removed from the map.

Parameters
world World
entity Entity

Returns
bool

Duplicate(string)

public GameAsset Duplicate(string name)

Parameters
name string

Returns
GameAsset

AssetsToBeSaved()

public List<T> AssetsToBeSaved()

Returns
List<T>

GetSimplifiedName()

public string GetSimplifiedName()

Returns
string

GetSplitNameWithEditorPath()

public String[] GetSplitNameWithEditorPath()

Returns
string[]

TryGetDynamicAsset()

public T TryGetDynamicAsset()

Returns
T

TryLoadLevel(Guid)

public virtual SavedWorld TryLoadLevel(Guid guid)

Get a world asset to instantiate in the game. This tracks the at SaveData._lastWorld.

Parameters
guid Guid

Returns
SavedWorld

AfterDeserialized()

public virtual void AfterDeserialized()

ChangeSaveName(string)

public void ChangeSaveName(string name)

Parameters
name string

MakeGuid()

public void MakeGuid()

RemoveDynamicAsset(Type)

public void RemoveDynamicAsset(Type t)

Parameters
t Type

SaveAsync(MonoWorld)

public void SaveAsync(MonoWorld world)

This saves a world that should be persisted across several runs. For now, this will be restricted to the city.

Parameters
world MonoWorld

SaveDynamicAsset(Guid)

public void SaveDynamicAsset(Guid guid)

Parameters
guid Guid

TrackAssetOnSave(Guid)

public void TrackAssetOnSave(Guid g)

Parameters
g Guid

TrackCurrentWorld(Guid)

public void TrackCurrentWorld(Guid guid)

Parameters
guid Guid