Browse Source

Export command and event handler annotation info to .csv fromat #89

master
chrisgregan 10 years ago
parent
commit
5c615401d8
  1. 35
      Assets/Fungus/FungusScript/Editor/SequenceEditor.cs

35
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<System.Type> menuTypes = EditorExtensions.FindDerivedTypes(typeof(Command)).ToList();
List<KeyValuePair<System.Type, CommandInfoAttribute>> 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<System.Type> 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;

Loading…
Cancel
Save