SaveDS.cs
Code: Select all
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using UnityEngine;
public class SaveDS : MonoBehaviour, ISaveable
{
public void OnLoad(JToken token)
{
string data = token["dialoguesystem"].ToObject<string>();
if (string.IsNullOrEmpty(data))
{
PixelCrushers.DialogueSystem.DialogueManager.ResetDatabase();
}
else
{
PixelCrushers.DialogueSystem.PersistentDataManager.ApplySaveData(data);
}
}
public Dictionary<string, object> OnSave()
{
return new Dictionary<string, object>()
{
{ "dialoguesystem", PixelCrushers.DialogueSystem.PersistentDataManager.GetSaveData() }
};
}
}