Browse Source

Refactored event handler names and categories

master
Christopher 8 years ago
parent
commit
881c1259bf
  1. 6
      Assets/Fungus/Scripts/Components/SaveManager.cs
  2. 2
      Assets/Fungus/Scripts/EventHandlers/FlowchartEnabled.cs
  3. 2
      Assets/Fungus/Scripts/EventHandlers/MessageReceived.cs
  4. 14
      Assets/Fungus/Scripts/EventHandlers/SavePointLoaded.cs
  5. 0
      Assets/Fungus/Scripts/EventHandlers/SavePointLoaded.cs.meta
  6. 11
      Assets/FungusExamples/SaveGame/SceneA.unity

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

@ -147,12 +147,12 @@ namespace Fungus
flowchart.SetStringVariable(stringVar.key, stringVar.value);
}
// Fire any matching GameLoaded event handler with matching save key.
var eventHandlers = Object.FindObjectsOfType<GameLoaded>();
// Fire any matching SavePointLoaded event handler with matching save key.
var eventHandlers = Object.FindObjectsOfType<SavePointLoaded>();
for (int i = 0; i < eventHandlers.Length; i++)
{
var eventHandler = eventHandlers[i];
eventHandler.OnGameLoaded(saveData.saveKey);
eventHandler.OnSavePointLoaded(saveData.saveKey);
}
// Execute any block with a Label matching the save key

2
Assets/Fungus/Scripts/EventHandlers/FlowchartEnabled.cs

@ -8,7 +8,7 @@ namespace Fungus
/// <summary>
/// The block will execute when the Flowchart game object is enabled.
/// </summary>
[EventHandlerInfo("",
[EventHandlerInfo("Scene",
"Flowchart Enabled",
"The block will execute when the Flowchart game object is enabled.")]
[AddComponentMenu("")]

2
Assets/Fungus/Scripts/EventHandlers/MessageReceived.cs

@ -8,7 +8,7 @@ namespace Fungus
/// <summary>
/// The block will execute when the specified message is received from a Send Message command.
/// </summary>
[EventHandlerInfo("",
[EventHandlerInfo("Scene",
"Message Received",
"The block will execute when the specified message is received from a Send Message command.")]
[AddComponentMenu("")]

14
Assets/Fungus/Scripts/EventHandlers/GameLoaded.cs → Assets/Fungus/Scripts/EventHandlers/SavePointLoaded.cs

@ -6,20 +6,20 @@ using System.Collections.Generic;
namespace Fungus
{
[EventHandlerInfo("",
"Game Loaded",
"Execute this block when a saved game is loaded.")]
public class GameLoaded : EventHandler
[EventHandlerInfo("Scene",
"Save Point Loaded",
"Execute this block when a saved point is loaded.")]
public class SavePointLoaded : EventHandler
{
[Tooltip("Block will execute if the Save Key of the loaded data matches an entry in the Save Keys list.")]
[Tooltip("Block will execute if the Save Key of the loaded save point 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.
/// Called when a save point is loaded.
/// </summary>
public void OnGameLoaded(string saveKey)
public void OnSavePointLoaded(string saveKey)
{
if (saveKeys.Contains(saveKey))
{

0
Assets/Fungus/Scripts/EventHandlers/GameLoaded.cs.meta → Assets/Fungus/Scripts/EventHandlers/SavePointLoaded.cs.meta

11
Assets/FungusExamples/SaveGame/SceneA.unity

@ -214,8 +214,7 @@ MonoBehaviour:
height: 909
selectedBlocks:
- {fileID: 27697883}
selectedCommands:
- {fileID: 27697875}
selectedCommands: []
variables:
- {fileID: 27697873}
description:
@ -284,7 +283,7 @@ MonoBehaviour:
stringVal:
--- !u!114 &27697875
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 27697867}
@ -399,7 +398,7 @@ MonoBehaviour:
- {fileID: 27697878}
--- !u!114 &27697881
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 27697867}
@ -413,7 +412,7 @@ MonoBehaviour:
key: save_1
--- !u!114 &27697882
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 27697867}
@ -432,7 +431,7 @@ MonoBehaviour:
'
--- !u!114 &27697883
MonoBehaviour:
m_ObjectHideFlags: 0
m_ObjectHideFlags: 2
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 27697867}

Loading…
Cancel
Save