Christopher
8 years ago
8 changed files with 225 additions and 86 deletions
@ -1,44 +0,0 @@ |
|||||||
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus). |
|
||||||
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
|
||||||
|
|
||||||
using UnityEditor; |
|
||||||
using UnityEngine; |
|
||||||
using Fungus; |
|
||||||
|
|
||||||
namespace Fungus.EditorUtils |
|
||||||
{ |
|
||||||
[CustomEditor(typeof(SavePoint))] |
|
||||||
public class SavePointEditor : CommandEditor |
|
||||||
{ |
|
||||||
protected SerializedProperty resumeBlockProp; |
|
||||||
protected SerializedProperty saveNowProp; |
|
||||||
|
|
||||||
protected virtual void OnEnable() |
|
||||||
{ |
|
||||||
if (NullTargetCheck()) // Check for an orphaned editor instance |
|
||||||
return; |
|
||||||
|
|
||||||
resumeBlockProp = serializedObject.FindProperty("resumeBlock"); |
|
||||||
saveNowProp = serializedObject.FindProperty("saveNow"); |
|
||||||
} |
|
||||||
|
|
||||||
public override void DrawCommandGUI() |
|
||||||
{ |
|
||||||
var flowchart = FlowchartWindow.GetFlowchart(); |
|
||||||
if (flowchart == null) |
|
||||||
{ |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
serializedObject.Update(); |
|
||||||
|
|
||||||
BlockEditor.BlockField(resumeBlockProp, |
|
||||||
new GUIContent("Resume Block", "Block to call when save data is loaded again"), |
|
||||||
new GUIContent("<None>"), |
|
||||||
flowchart); |
|
||||||
EditorGUILayout.PropertyField(saveNowProp); |
|
||||||
|
|
||||||
serializedObject.ApplyModifiedProperties(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,32 @@ |
|||||||
|
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus). |
||||||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||||
|
|
||||||
|
using UnityEngine; |
||||||
|
using System.Collections.Generic; |
||||||
|
|
||||||
|
namespace Fungus |
||||||
|
{ |
||||||
|
[EventHandlerInfo("", |
||||||
|
"Game Loaded", |
||||||
|
"Execute this block when a saved game is loaded.")] |
||||||
|
public class GameLoaded : EventHandler |
||||||
|
{ |
||||||
|
[Tooltip("Block will execute if the Save Key of the loaded data matches an entry in the Save Keys list.")] |
||||||
|
[SerializeField] protected List<string> saveKeys = new List<string>(); |
||||||
|
|
||||||
|
#region Public methods |
||||||
|
|
||||||
|
/// <summary> |
||||||
|
/// Called when a saved game is loaded. |
||||||
|
/// </summary> |
||||||
|
public void OnGameLoaded(string saveKey) |
||||||
|
{ |
||||||
|
if (saveKeys.Contains(saveKey)) |
||||||
|
{ |
||||||
|
ExecuteBlock(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
#endregion |
||||||
|
} |
||||||
|
} |
@ -1,6 +1,6 @@ |
|||||||
fileFormatVersion: 2 |
fileFormatVersion: 2 |
||||||
guid: 84d5f60f59d254712915dd59d345e0c6 |
guid: 9ca33a026786245d4b10323b87e84d5f |
||||||
timeCreated: 1478701789 |
timeCreated: 1479142351 |
||||||
licenseType: Free |
licenseType: Free |
||||||
MonoImporter: |
MonoImporter: |
||||||
serializedVersion: 2 |
serializedVersion: 2 |
Loading…
Reference in new issue