Class: SaveLoadManager

SaveLoadManager(engine)

new SaveLoadManager(engine)

Parameters:
Name Type Description
engine
Source:

Methods

(async) deleteAllSlots() → {Promise.<void>}

Deletes all game save slots.
Source:
Returns:
Type
Promise.<void>

(async) deleteSlot(slotId) → {Promise.<void>}

Deletes a save slot.
Parameters:
Name Type Description
slotId string | number The identifier for the save slot to delete.
Source:
Returns:
Type
Promise.<void>

(async) getSaveSlots() → {Promise.<Array.<{slotId: (string|number), timestamp: number, metadata: object}>>}

Retrieves metadata for all available save slots.
Source:
Returns:
Type
Promise.<Array.<{slotId: (string|number), timestamp: number, metadata: object}>>

(async) loadGame(slotId) → {Promise.<(object|null)>}

Loads game state from a specified slot. It calls `loadSaveData` on all registered providers. The game will then need to orchestrate scene transitions and state setup based on the loaded data, often in response to the 'loadGameCompleted' event or by using the returned data.
Parameters:
Name Type Description
slotId string | number The identifier for the save slot.
Source:
Returns:
The full loaded save data object if successful, or null on failure.
Type
Promise.<(object|null)>

registerDataProvider(uniqueKey, provider)

Registers a data provider with the SaveLoadManager.
Parameters:
Name Type Description
uniqueKey string A unique key to identify this provider's data in the save file.
provider Object The provider object.
Source:

(async) saveGame(slotId, userMetadataopt) → {Promise.<boolean>}

Saves the current game state to a specified slot.
Parameters:
Name Type Attributes Default Description
slotId string | number The identifier for the save slot.
userMetadata object <optional>
{} Optional metadata to save (e.g., playerName, level, currentSceneName for display).
Source:
Returns:
True if saving was successful, false otherwise.
Type
Promise.<boolean>

unregisterDataProvider(uniqueKey)

Unregisters a data provider.
Parameters:
Name Type Description
uniqueKey string The key of the provider to unregister.
Source: