|
|
|
@ -39,6 +39,21 @@ namespace Fungus.EditorUtils
|
|
|
|
|
protected Texture2D duplicateIcon; |
|
|
|
|
protected Texture2D deleteIcon; |
|
|
|
|
|
|
|
|
|
static List<System.Type> commandTypes; |
|
|
|
|
static List<System.Type> eventHandlerTypes; |
|
|
|
|
|
|
|
|
|
static void CacheEventHandlerTypes() |
|
|
|
|
{ |
|
|
|
|
eventHandlerTypes = EditorExtensions.FindDerivedTypes(typeof(EventHandler)).ToList(); |
|
|
|
|
commandTypes = EditorExtensions.FindDerivedTypes(typeof(Command)).ToList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
[UnityEditor.Callbacks.DidReloadScripts] |
|
|
|
|
private static void OnScriptsReloaded() |
|
|
|
|
{ |
|
|
|
|
CacheEventHandlerTypes(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected virtual void OnEnable() |
|
|
|
|
{ |
|
|
|
|
upIcon = FungusEditorResources.Up; |
|
|
|
@ -46,6 +61,8 @@ namespace Fungus.EditorUtils
|
|
|
|
|
addIcon = FungusEditorResources.Add; |
|
|
|
|
duplicateIcon = FungusEditorResources.Duplicate; |
|
|
|
|
deleteIcon = FungusEditorResources.Delete; |
|
|
|
|
|
|
|
|
|
CacheEventHandlerTypes(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual void DrawBlockName(Flowchart flowchart) |
|
|
|
@ -317,8 +334,6 @@ namespace Fungus.EditorUtils
|
|
|
|
|
{ |
|
|
|
|
// Show available Event Handlers in a drop down list with type of current |
|
|
|
|
// event handler selected. |
|
|
|
|
List<System.Type> eventHandlerTypes = EditorExtensions.FindDerivedTypes(typeof(EventHandler)).ToList(); |
|
|
|
|
|
|
|
|
|
Block block = target as Block; |
|
|
|
|
System.Type currentType = null; |
|
|
|
|
if (block._EventHandler != null) |
|
|
|
@ -667,8 +682,7 @@ namespace Fungus.EditorUtils
|
|
|
|
|
GenericMenu commandMenu = new GenericMenu(); |
|
|
|
|
|
|
|
|
|
// Build menu list |
|
|
|
|
List<System.Type> menuTypes = EditorExtensions.FindDerivedTypes(typeof(Command)).ToList(); |
|
|
|
|
List<KeyValuePair<System.Type, CommandInfoAttribute>> filteredAttributes = GetFilteredCommandInfoAttribute(menuTypes); |
|
|
|
|
List<KeyValuePair<System.Type, CommandInfoAttribute>> filteredAttributes = GetFilteredCommandInfoAttribute(commandTypes); |
|
|
|
|
|
|
|
|
|
filteredAttributes.Sort( CompareCommandAttributes ); |
|
|
|
|
|
|
|
|
|