Browse Source

Added description fields to Invoke Event and Invoke Method

master
Christopher 8 years ago
parent
commit
d3ed078c9e
  1. 8
      Assets/Fungus/Scripts/Commands/InvokeEvent.cs
  2. 8
      Assets/Fungus/Scripts/Commands/InvokeMethod.cs
  3. 3
      Assets/Fungus/Scripts/Editor/InvokeEventEditor.cs

8
Assets/Fungus/Scripts/Commands/InvokeEvent.cs

@ -36,6 +36,9 @@ namespace Fungus
[AddComponentMenu("")]
public class InvokeEvent : Command
{
[Tooltip("A description of what this command does. Appears in the command summary.")]
[SerializeField] protected string description = "";
[Tooltip("Delay (in seconds) before the methods will be called")]
[SerializeField] protected float delay;
@ -115,6 +118,11 @@ namespace Fungus
public override string GetSummary()
{
if (!string.IsNullOrEmpty(description))
{
return description;
}
string summary = invokeType.ToString() + " ";
switch (invokeType)

8
Assets/Fungus/Scripts/Commands/InvokeMethod.cs

@ -19,6 +19,9 @@ namespace Fungus
"Invokes a method of a component via reflection. Supports passing multiple parameters and storing returned values in a Fungus variable.")]
public class InvokeMethod : Command
{
[Tooltip("A description of what this command does. Appears in the command summary.")]
[SerializeField] protected string description = "";
[Tooltip("GameObject containing the component method to be invoked")]
[SerializeField] protected GameObject targetObject;
@ -312,6 +315,11 @@ namespace Fungus
return "Error: targetObject is not assigned";
}
if (!string.IsNullOrEmpty(description))
{
return description;
}
return targetObject.name + "." + targetComponentText + "." + targetMethodText;
}

3
Assets/Fungus/Scripts/Editor/InvokeEventEditor.cs

@ -8,6 +8,7 @@ namespace Fungus.EditorUtils
[CustomEditor (typeof(InvokeEvent))]
public class InvokeEventEditor : CommandEditor
{
protected SerializedProperty descriptionProp;
protected SerializedProperty delayProp;
protected SerializedProperty invokeTypeProp;
protected SerializedProperty staticEventProp;
@ -25,6 +26,7 @@ namespace Fungus.EditorUtils
if (NullTargetCheck()) // Check for an orphaned editor instance
return;
descriptionProp = serializedObject.FindProperty("description");
delayProp = serializedObject.FindProperty("delay");
invokeTypeProp = serializedObject.FindProperty("invokeType");
staticEventProp = serializedObject.FindProperty("staticEvent");
@ -42,6 +44,7 @@ namespace Fungus.EditorUtils
{
serializedObject.Update();
EditorGUILayout.PropertyField(descriptionProp);
EditorGUILayout.PropertyField(delayProp);
EditorGUILayout.PropertyField(invokeTypeProp);

Loading…
Cancel
Save