From 5c615401d82bf2b79d55d4cdacd2ab25a27f48df Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 26 Mar 2015 14:51:28 +0000 Subject: [PATCH] Export command and event handler annotation info to .csv fromat #89 --- .../FungusScript/Editor/SequenceEditor.cs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs b/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs index 5c291819..8c4f7cab 100644 --- a/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs +++ b/Assets/Fungus/FungusScript/Editor/SequenceEditor.cs @@ -6,6 +6,7 @@ using System.Collections; using System.Collections.Generic; using System.Linq; using Rotorz.ReorderableList; +using System.IO; namespace Fungus { @@ -467,6 +468,40 @@ namespace Fungus return compare; } + [MenuItem("Tools/Fungus/Export Class Info")] + protected static void DumpFungusClassInfo() + { + string path = EditorUtility.SaveFilePanel("Export strings", "", + "FungusClasses.csv", ""); + + if(path.Length == 0) + { + return; + } + + string classInfo = ""; + + // Dump command info + List menuTypes = EditorExtensions.FindDerivedTypes(typeof(Command)).ToList(); + List> filteredAttributes = GetFilteredCommandInfoAttribute(menuTypes); + filteredAttributes.Sort( CompareCommandAttributes ); + foreach(var keyPair in filteredAttributes) + { + CommandInfoAttribute info = keyPair.Value; + classInfo += ("Command," + info.CommandName + "," + info.Category + ",\"" + info.HelpText + "\"\n"); + } + + // Dump event handler info + List eventHandlerTypes = EditorExtensions.FindDerivedTypes(typeof(EventHandler)).ToList(); + foreach (System.Type type in eventHandlerTypes) + { + EventHandlerInfoAttribute info = EventHandlerEditor.GetEventHandlerInfo(type); + classInfo += ("EventHandler," + info.EventHandlerName + "," + info.Category + ",\"" + info.HelpText + "\"\n"); + } + + File.WriteAllText(path, classInfo); + } + void ShowCommandMenu() { Sequence sequence = target as Sequence;