Browse Source

Added save description field

master
Christopher 8 years ago
parent
commit
a9600010bf
  1. 4
      Assets/Fungus/Scripts/Commands/SavePoint.cs
  2. 7
      Assets/Fungus/Scripts/Components/SaveManager.cs
  3. 2
      Assets/Fungus/Scripts/SavePoints/SavePointData.cs
  4. 6
      Assets/FungusExamples/SaveGame/SceneA.unity

4
Assets/Fungus/Scripts/Commands/SavePoint.cs

@ -14,6 +14,8 @@ namespace Fungus
{
[SerializeField] protected string saveKey;
[SerializeField] protected string description;
[SerializeField] protected bool saveNow;
#region Public members
@ -22,7 +24,7 @@ namespace Fungus
{
var saveManager = FungusManager.Instance.SaveManager;
saveManager.PopulateSaveBuffer(GetFlowchart(), saveKey);
saveManager.PopulateSaveBuffer(GetFlowchart(), saveKey, description);
if (saveNow)
{

7
Assets/Fungus/Scripts/Components/SaveManager.cs

@ -55,13 +55,14 @@ namespace Fungus
return true;
}
protected virtual string CreateSaveData(Flowchart flowchart, string saveKey)
protected virtual string CreateSaveData(Flowchart flowchart, string saveKey, string description)
{
var saveData = new SavePointData();
// Store the scene, flowchart and block to execute on resume
saveData.SceneName = SceneManager.GetActiveScene().name;
saveData.SaveKey = saveKey;
saveData.Description = description;
var flowchartData = FlowchartData.Encode(flowchart);
saveData.FlowchartData.Add(flowchartData);
@ -181,9 +182,9 @@ namespace Fungus
PlayerPrefs.DeleteKey(key);
}
public virtual void PopulateSaveBuffer(Flowchart flowchart, string saveKey)
public virtual void PopulateSaveBuffer(Flowchart flowchart, string saveKey, string description)
{
saveBuffer = CreateSaveData(flowchart, saveKey);
saveBuffer = CreateSaveData(flowchart, saveKey, description);
}
#endregion

2
Assets/Fungus/Scripts/SavePoints/SavePointData.cs

@ -7,12 +7,14 @@ namespace Fungus
public class SavePointData
{
[SerializeField] protected string saveKey;
[SerializeField] protected string description;
[SerializeField] protected string sceneName;
[SerializeField] protected List<FlowchartData> flowchartData = new List<FlowchartData>();
#region Public methods
public string SaveKey { get { return saveKey; } set { saveKey = value; } }
public string Description { get { return description; } set { description = value; } }
public string SceneName { get { return sceneName; } set { sceneName = value; } }
public List<FlowchartData> FlowchartData { get { return flowchartData; } set { flowchartData = value; } }

6
Assets/FungusExamples/SaveGame/SceneA.unity

@ -213,8 +213,9 @@ MonoBehaviour:
width: 1328
height: 909
selectedBlocks:
- {fileID: 27697883}
selectedCommands: []
- {fileID: 27697870}
selectedCommands:
- {fileID: 27697876}
variables:
- {fileID: 27697873}
description:
@ -312,6 +313,7 @@ MonoBehaviour:
itemId: 5
indentLevel: 0
saveKey: save_1
description: Entering the forest
saveNow: 0
--- !u!114 &27697877
MonoBehaviour:

Loading…
Cancel
Save