Skip to content

Commit

Permalink
Add onDidLoadState event to StoryState
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkail committed Feb 22, 2021
1 parent aad6167 commit db81526
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ink-engine-runtime/StoryState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ public class StoryState
public const int kInkSaveStateVersion = 9; // new: multi-flows, but backward compatible
const int kMinCompatibleLoadVersion = 8;

/// <summary>
/// Callback for when a state is loaded
/// </summary>
public event Action onDidLoadState;

/// <summary>
/// Exports the current state to json format, in order to save the game.
/// </summary>
Expand Down Expand Up @@ -48,6 +53,7 @@ public void LoadJson(string json)
{
var jObject = SimpleJson.TextToDictionary (json);
LoadJsonObj(jObject);
if(onDidLoadState != null) onDidLoadState();
}

/// <summary>
Expand Down

0 comments on commit db81526

Please sign in to comment.