From 819b6c52c76263543518ade0a6317c5874cf0738 Mon Sep 17 00:00:00 2001 From: Christopher Date: Thu, 26 Jan 2017 11:08:48 +0000 Subject: [PATCH] Added custom editor for Save Point Loaded event handler --- .../Scripts/Editor/SavePointLoadedEditor.cs | 30 +++++++++++++++++++ .../Editor/SavePointLoadedEditor.cs.meta | 12 ++++++++ .../Scripts/EventHandlers/SavePointLoaded.cs | 2 +- 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs create mode 100644 Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs.meta diff --git a/Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs b/Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs new file mode 100644 index 00000000..9ff2532f --- /dev/null +++ b/Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs @@ -0,0 +1,30 @@ +// 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) + +#if UNITY_5_3_OR_NEWER + +using UnityEngine; +using UnityEditor; +using Rotorz.ReorderableList; + +namespace Fungus.EditorUtils +{ + [CustomEditor (typeof(SavePointLoaded), true)] + public class SavePointLoadedEditor : EventHandlerEditor + { + protected SerializedProperty savePointKeysProp; + + protected virtual void OnEnable() + { + savePointKeysProp = serializedObject.FindProperty("savePointKeys"); + } + + protected override void DrawProperties() + { + ReorderableListGUI.Title("Save Point Keys"); + ReorderableListGUI.ListField(savePointKeysProp); + } + } +} + +#endif \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs.meta b/Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs.meta new file mode 100644 index 00000000..4e2c4995 --- /dev/null +++ b/Assets/Fungus/Scripts/Editor/SavePointLoadedEditor.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 8514e225c506c4938a5da19210cc6217 +timeCreated: 1484049679 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Fungus/Scripts/EventHandlers/SavePointLoaded.cs b/Assets/Fungus/Scripts/EventHandlers/SavePointLoaded.cs index 9d2a61cb..f95d8682 100644 --- a/Assets/Fungus/Scripts/EventHandlers/SavePointLoaded.cs +++ b/Assets/Fungus/Scripts/EventHandlers/SavePointLoaded.cs @@ -8,7 +8,7 @@ namespace Fungus { [EventHandlerInfo("Scene", "Save Point Loaded", - "Execute this block when a saved point is loaded. Use the 'new_game' key to handle game start.")] + "Execute this block when a saved point is loaded. Use the 'new_game' key to handle game start.")] public class SavePointLoaded : EventHandler { [Tooltip("Block will execute if the Save Key of the loaded save point matches this save key.")]