BlackboardEvents sent by Save and Load

v4.0

The SaveAndLoad script will automatically connect with the MainBlackboard. Events will be sent which other scripts can listen for.

The event topic and gameId will always be "Save and Load" and "Game Data" respectively. The status value will indicate which step triggered the event, and the obj will be the saveGameId that is being managed.

// topic will always be "Save and Load"
// gameId will always be "Game Data"
// status will indicate which save or load step triggered the event
// obj will have the SaveId being managed, but may be null in some cases

// EVENTS SENT (will be in the status value of the BlackboardEvent)
// "Save Start" [obj = the SaveGameId being saved]
// "Save End" [obj = the SaveGameId being saved]
// "Load Start" [obj = the SaveGameId being loaded]
// "Load End" [obj = the SaveGameId being loaded]

// Examples on how to listen for BlackboardEvents from the Save and Load module
public override void ReceiveEvent(BlackboardEvent blackboardEvent)
{
    // Save Start and Save End events do not include any data in
    // the obj value, so they are ignored here.
    if (blackboardEvent.topic == "Save and Load" 
        && blackboardEvent.gameId == "Game Data" 
        && blackboardEvent.status == "Save Start")
    {
        PreSaveActions();
    }
        
    if (blackboardEvent.topic == "Save and Load" 
        && blackboardEvent.gameId == "Game Data" 
        && blackboardEvent.status == "Save End")
    {
        PostSaveActions();
    }
}

There will also be an event sent when the Game List is saved or loaded:

// Do something when the Game List is saved...
if (blackboardEvent.topic == "Save and Load" 
    && blackboardEvent.gameId == "Game List"  // Not "Game Data" here!
    && blackboardEvent.status == "Saved")
{
    // Game List was saved!
}

// Do something when the Game List is loaded...
if (blackboardEvent.topic == "Save and Load" 
    && blackboardEvent.gameId == "Game List"  // Not "Game Data" here!
    && blackboardEvent.status == "Loaded")
{
    // Game List was loaded!
}

Last updated