using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace Fungus
{
[System.Serializable]
public class SavePointData
{
///
/// Version number of current save data format.
///
protected const int SavePointDataVersion = 0;
[SerializeField] protected int version;
[SerializeField] protected string saveKey;
[SerializeField] protected string description;
[SerializeField] protected string sceneName;
[SerializeField] protected List flowchartDatas = new List();
protected static SavePointData tempSavePointData;
protected static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
if (scene.name != tempSavePointData.SceneName)
{
return;
}
SceneManager.sceneLoaded -= OnSceneLoaded;
var savePointData = tempSavePointData;
for (int i = 0; i < savePointData.FlowchartDatas.Count; i++)
{
var flowchartData = savePointData.FlowchartDatas[i];
FlowchartData.Decode(flowchartData);
}
NotifyEventHandlers(savePointData);
ExecuteBlocks(savePointData);
}
protected static void NotifyEventHandlers(SavePointData savePointData)
{
// Fire any matching SavePointLoaded event handler with matching save key.
var eventHandlers = Object.FindObjectsOfType();
for (int i = 0; i < eventHandlers.Length; i++)
{
var eventHandler = eventHandlers[i];
eventHandler.OnSavePointLoaded(savePointData.SaveKey);
}
}
protected static void ExecuteBlocks(SavePointData savePointData)
{
// Execute any block containing a Label matching the save key
var labels = Object.FindObjectsOfType