Browse Source

Added virtual method to provide custom Event Handler summary

master
chrisgregan 10 years ago
parent
commit
003069a201
  1. 8
      Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs
  2. 10
      Assets/Fungus/FungusScript/Scripts/EventHandler.cs

8
Assets/Fungus/FungusScript/Editor/FungusScriptWindow.cs

@ -386,7 +386,13 @@ namespace Fungus
EventHandlerInfoAttribute info = EventHandlerEditor.GetEventHandlerInfo(sequence.eventHandler.GetType()); EventHandlerInfoAttribute info = EventHandlerEditor.GetEventHandlerInfo(sequence.eventHandler.GetType());
if (info != null) if (info != null)
{ {
nodeName = "(" + info.EventHandlerName + ")\n"; string handlerSummary = sequence.eventHandler.GetSummary();
if (handlerSummary == "")
{
handlerSummary = info.EventHandlerName;
}
nodeName = "(" + handlerSummary + ")\n";
nodeStyle.padding.top = 23; // Adjust label to fit on two lines nodeStyle.padding.top = 23; // Adjust label to fit on two lines
} }

10
Assets/Fungus/FungusScript/Scripts/EventHandler.cs

@ -48,5 +48,15 @@ namespace Fungus
FungusScript fungusScript = parentSequence.GetFungusScript(); FungusScript fungusScript = parentSequence.GetFungusScript();
return fungusScript.ExecuteSequence(parentSequence); return fungusScript.ExecuteSequence(parentSequence);
} }
/**
* Returns a custom summary for the event handler.
* If the string is empty, the editor will use the EventHandlerName property of
* the EventHandlerInfo attribute instead.
*/
public virtual string GetSummary()
{
return "";
}
} }
} }

Loading…
Cancel
Save