Browse Source

Renamed save commands

master
Christopher 8 years ago
parent
commit
43a8aabccf
  1. 10
      Assets/Fungus/Scripts/Commands/LoadGame.cs
  2. 0
      Assets/Fungus/Scripts/Commands/LoadGame.cs.meta
  3. 10
      Assets/Fungus/Scripts/Commands/SavePoint.cs
  4. 0
      Assets/Fungus/Scripts/Commands/SavePoint.cs.meta
  5. 16
      Assets/Fungus/Scripts/Editor/SavePointEditor.cs
  6. 0
      Assets/Fungus/Scripts/Editor/SavePointEditor.cs.meta
  7. 85
      Assets/FungusExamples/SaveGame/SceneA.unity
  8. 4
      ProjectSettings/EditorBuildSettings.asset

10
Assets/Fungus/Scripts/Commands/LoadFlowchart.cs → Assets/Fungus/Scripts/Commands/LoadGame.cs

@ -2,15 +2,13 @@
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) // It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement;
using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
[CommandInfo("Variable", [CommandInfo("Variable",
"Load Flowchart", "Load Game",
"Loads a previously saved Flowchart state. The original scene is loaded and the resume block is executed.")] "Loads a previously saved game. The original scene is loaded and the resume block is executed.")]
public class LoadFlowchart : Command public class LoadGame : Command
{ {
[SerializeField] protected IntegerData saveSlot = new IntegerData(0); [SerializeField] protected IntegerData saveSlot = new IntegerData(0);
@ -20,7 +18,7 @@ namespace Fungus
{ {
var saveManager = FungusManager.Instance.SaveManager; var saveManager = FungusManager.Instance.SaveManager;
saveManager.Load(0); saveManager.Load(saveSlot.Value);
} }
public override string GetSummary() public override string GetSummary()

0
Assets/Fungus/Scripts/Commands/LoadFlowchart.cs.meta → Assets/Fungus/Scripts/Commands/LoadGame.cs.meta

10
Assets/Fungus/Scripts/Commands/SaveFlowchart.cs → Assets/Fungus/Scripts/Commands/SavePoint.cs

@ -8,13 +8,13 @@ using System.Collections.Generic;
namespace Fungus namespace Fungus
{ {
[CommandInfo("Variable", [CommandInfo("Variable",
"Save Flowchart", "Save Point",
"Saves the current Flowchart variable state to be loaded again in future.")] "Creates a save point which can be saved to persistant storage and loaded again later.")]
public class SaveFlowchart : Command public class SavePoint : Command
{ {
[SerializeField] protected Block resumeBlock; [SerializeField] protected Block resumeBlock;
[SerializeField] protected bool saveImmediately; [SerializeField] protected bool saveNow;
#region Public members #region Public members
@ -24,7 +24,7 @@ namespace Fungus
saveManager.PopulateSaveBuffer(GetFlowchart(), resumeBlock.BlockName); saveManager.PopulateSaveBuffer(GetFlowchart(), resumeBlock.BlockName);
if (saveImmediately) if (saveNow)
{ {
saveManager.Save(); saveManager.Save();
} }

0
Assets/Fungus/Scripts/Commands/SaveFlowchart.cs.meta → Assets/Fungus/Scripts/Commands/SavePoint.cs.meta

16
Assets/Fungus/Scripts/Editor/SaveFlowchartEditor.cs → Assets/Fungus/Scripts/Editor/SavePointEditor.cs

@ -7,11 +7,11 @@ using Fungus;
namespace Fungus.EditorUtils namespace Fungus.EditorUtils
{ {
[CustomEditor(typeof(SaveFlowchart))] [CustomEditor(typeof(SavePoint))]
public class SaveFlowchartEditor : CommandEditor public class SavePointEditor : CommandEditor
{ {
protected SerializedProperty resumeBlockProp; protected SerializedProperty resumeBlockProp;
protected SerializedProperty saveImmediatelyProp; protected SerializedProperty saveNowProp;
protected virtual void OnEnable() protected virtual void OnEnable()
{ {
@ -19,7 +19,7 @@ namespace Fungus.EditorUtils
return; return;
resumeBlockProp = serializedObject.FindProperty("resumeBlock"); resumeBlockProp = serializedObject.FindProperty("resumeBlock");
saveImmediatelyProp = serializedObject.FindProperty("saveImmediately"); saveNowProp = serializedObject.FindProperty("saveNow");
} }
public override void DrawCommandGUI() public override void DrawCommandGUI()
@ -33,10 +33,10 @@ namespace Fungus.EditorUtils
serializedObject.Update(); serializedObject.Update();
BlockEditor.BlockField(resumeBlockProp, BlockEditor.BlockField(resumeBlockProp,
new GUIContent("Resume Block", "Block to call when save data is loaded again"), new GUIContent("Resume Block", "Block to call when save data is loaded again"),
new GUIContent("<None>"), new GUIContent("<None>"),
flowchart); flowchart);
EditorGUILayout.PropertyField(saveImmediatelyProp); EditorGUILayout.PropertyField(saveNowProp);
serializedObject.ApplyModifiedProperties(); serializedObject.ApplyModifiedProperties();
} }

0
Assets/Fungus/Scripts/Editor/SaveFlowchartEditor.cs.meta → Assets/Fungus/Scripts/Editor/SavePointEditor.cs.meta

85
Assets/FungusExamples/SaveGame/SceneA.unity

@ -103,6 +103,9 @@ GameObject:
- 114: {fileID: 27697869} - 114: {fileID: 27697869}
- 114: {fileID: 27697868} - 114: {fileID: 27697868}
- 114: {fileID: 27697873} - 114: {fileID: 27697873}
- 114: {fileID: 27697874}
- 114: {fileID: 27697875}
- 114: {fileID: 27697876}
m_Layer: 0 m_Layer: 0
m_Name: Flowchart m_Name: Flowchart
m_TagString: Untagged m_TagString: Untagged
@ -175,6 +178,8 @@ MonoBehaviour:
eventHandler: {fileID: 27697869} eventHandler: {fileID: 27697869}
commandList: commandList:
- {fileID: 27697868} - {fileID: 27697868}
- {fileID: 27697874}
- {fileID: 27697876}
--- !u!114 &27697871 --- !u!114 &27697871
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -195,12 +200,14 @@ MonoBehaviour:
zoom: 1 zoom: 1
scrollViewRect: scrollViewRect:
serializedVersion: 2 serializedVersion: 2
x: -343 x: -350
y: -340 y: -350
width: 1114 width: 1121
height: 859 height: 869
selectedBlocks: [] selectedBlocks:
selectedCommands: [] - {fileID: 27697870}
selectedCommands:
- {fileID: 27697876}
variables: variables:
- {fileID: 27697873} - {fileID: 27697873}
description: description:
@ -240,6 +247,72 @@ MonoBehaviour:
scope: 0 scope: 0
key: Count key: Count
value: 0 value: 0
--- !u!114 &27697874
MonoBehaviour:
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 27697867}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fb77d0ce495044f6e9feb91b31798e8c, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 2
indentLevel: 0
variable: {fileID: 27697873}
setOperator: 2
booleanData:
booleanRef: {fileID: 0}
booleanVal: 0
integerData:
integerRef: {fileID: 0}
integerVal: 1
floatData:
floatRef: {fileID: 0}
floatVal: 0
stringData:
stringRef: {fileID: 0}
stringVal:
--- !u!114 &27697875
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 27697867}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3}
m_Name:
m_EditorClassIdentifier:
nodeRect:
serializedVersion: 2
x: 224
y: 74
width: 120
height: 40
tint: {r: 1, g: 1, b: 1, a: 1}
useCustomTint: 0
itemId: 4
blockName: New Block
description:
eventHandler: {fileID: 0}
commandList: []
--- !u!114 &27697876
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 27697867}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b115619cb83b4d6ab8047d0e9407403, type: 3}
m_Name:
m_EditorClassIdentifier:
itemId: 5
indentLevel: 0
resumeBlock: {fileID: 27697875}
saveNow: 0
--- !u!1 &132834842 --- !u!1 &132834842
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

4
ProjectSettings/EditorBuildSettings.asset

@ -6,6 +6,6 @@ EditorBuildSettings:
serializedVersion: 2 serializedVersion: 2
m_Scenes: m_Scenes:
- enabled: 1 - enabled: 1
path: Assets/FungusExamples/Sherlock/TheExperiment.unity path: Assets/FungusExamples/SaveGame/Menu.unity
- enabled: 1 - enabled: 1
path: Assets/Tests/Lua/SceneB.unity path: Assets/FungusExamples/SaveGame/SceneA.unity

Loading…
Cancel
Save