@ -66,7 +66,7 @@ namespace Fungus.Script
object [ ] attributes = type . GetCustomAttributes ( false ) ;
object [ ] attributes = type . GetCustomAttributes ( false ) ;
foreach ( object obj in attributes )
foreach ( object obj in attributes )
{
{
CommandCategory Attribute categoryAttr = obj as CommandCategory Attribute ;
CommandInfo Attribute categoryAttr = obj as CommandInfo Attribute ;
if ( categoryAttr ! = null )
if ( categoryAttr ! = null )
{
{
if ( ! categories . Contains ( categoryAttr . Category ) )
if ( ! categories . Contains ( categoryAttr . Category ) )
@ -88,20 +88,18 @@ namespace Fungus.Script
string categoryName = categories [ selectedCategoryIndex ] ;
string categoryName = categories [ selectedCategoryIndex ] ;
foreach ( System . Type type in subTypes )
foreach ( System . Type type in subTypes )
{
{
object [ ] attributes = type . GetCustomAttributes ( fals e) ;
CommandInfoAttribute commandInfoAttr = FungusCommandEditor . GetCommandInfo ( typ e) ;
foreach ( object obj in attributes )
if ( commandInfoAttr = = null )
{
{
CommandCategoryAttribute categoryAttr = obj as CommandCategoryAttribut e;
continu e;
if ( categoryAttr ! = null )
}
{
if ( categoryAttr . Category = = categoryName )
if ( categoryName = = commandInfoAttr . Category )
{
{
commandNames . Add ( FungusScriptEditor . GetCommandName ( type ) ) ;
commandNames . Add ( commandInfoAttr . CommandName ) ;
commandTypes . Add ( type ) ;
commandTypes . Add ( type ) ;
}
}
}
}
}
}
int selectedCommandIndex = EditorGUILayout . Popup ( fungusScript . selectedAddCommandIndex , commandNames . ToArray ( ) ) ;
int selectedCommandIndex = EditorGUILayout . Popup ( fungusScript . selectedAddCommandIndex , commandNames . ToArray ( ) ) ;
if ( selectedCategoryIndex ! = fungusScript . selectedCommandCategoryIndex )
if ( selectedCategoryIndex ! = fungusScript . selectedCommandCategoryIndex )
@ -152,17 +150,12 @@ namespace Fungus.Script
EditorGUILayout . EndHorizontal ( ) ;
EditorGUILayout . EndHorizontal ( ) ;
object [ ] helpAttributes = selectedType . GetCustomAttributes ( typeof ( HelpTextAttribute ) , false ) ;
CommandInfoAttribute infoAttr = FungusCommandEditor . GetCommandInfo ( selectedType ) ;
foreach ( object obj in helpAttributes )
if ( infoAttr ! = null )
{
HelpTextAttribute helpTextAttr = obj as HelpTextAttribute ;
if ( helpTextAttr ! = null )
{
{
GUIStyle labelStyle = new GUIStyle ( EditorStyles . miniLabel ) ;
GUIStyle labelStyle = new GUIStyle ( EditorStyles . miniLabel ) ;
labelStyle . wordWrap = true ;
labelStyle . wordWrap = true ;
EditorGUILayout . HelpBox ( helpTextAttr . HelpText , MessageType . Info ) ;
EditorGUILayout . HelpBox ( infoAttr . HelpText , MessageType . Info ) ;
break ;
}
}
}
serializedObject . ApplyModifiedProperties ( ) ;
serializedObject . ApplyModifiedProperties ( ) ;