You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
75 lines
3.3 KiB
75 lines
3.3 KiB
8 years ago
|
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
|
||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
|
||
9 years ago
|
|
||
9 years ago
|
using UnityEditor;
|
||
|
|
||
|
namespace Fungus
|
||
|
{
|
||
8 years ago
|
[CustomEditor (typeof(InvokeEvent))]
|
||
|
public class InvokeEventEditor : CommandEditor
|
||
|
{
|
||
|
protected SerializedProperty delayProp;
|
||
|
protected SerializedProperty invokeTypeProp;
|
||
|
protected SerializedProperty staticEventProp;
|
||
|
protected SerializedProperty booleanParameterProp;
|
||
|
protected SerializedProperty booleanEventProp;
|
||
|
protected SerializedProperty integerParameterProp;
|
||
|
protected SerializedProperty integerEventProp;
|
||
|
protected SerializedProperty floatParameterProp;
|
||
|
protected SerializedProperty floatEventProp;
|
||
|
protected SerializedProperty stringParameterProp;
|
||
|
protected SerializedProperty stringEventProp;
|
||
9 years ago
|
|
||
8 years ago
|
protected virtual void OnEnable()
|
||
|
{
|
||
|
if (NullTargetCheck()) // Check for an orphaned editor instance
|
||
|
return;
|
||
9 years ago
|
|
||
8 years ago
|
delayProp = serializedObject.FindProperty("delay");
|
||
|
invokeTypeProp = serializedObject.FindProperty("invokeType");
|
||
|
staticEventProp = serializedObject.FindProperty("staticEvent");
|
||
|
booleanParameterProp = serializedObject.FindProperty("booleanParameter");
|
||
|
booleanEventProp = serializedObject.FindProperty("booleanEvent");
|
||
|
integerParameterProp = serializedObject.FindProperty("integerParameter");
|
||
|
integerEventProp = serializedObject.FindProperty("integerEvent");
|
||
|
floatParameterProp = serializedObject.FindProperty("floatParameter");
|
||
|
floatEventProp = serializedObject.FindProperty("floatEvent");
|
||
|
stringParameterProp = serializedObject.FindProperty("stringParameter");
|
||
|
stringEventProp = serializedObject.FindProperty("stringEvent");
|
||
|
}
|
||
9 years ago
|
|
||
8 years ago
|
public override void DrawCommandGUI()
|
||
|
{
|
||
|
serializedObject.Update();
|
||
9 years ago
|
|
||
8 years ago
|
EditorGUILayout.PropertyField(delayProp);
|
||
|
EditorGUILayout.PropertyField(invokeTypeProp);
|
||
9 years ago
|
|
||
8 years ago
|
switch ((InvokeEvent.InvokeType)invokeTypeProp.enumValueIndex)
|
||
|
{
|
||
|
case InvokeEvent.InvokeType.Static:
|
||
|
EditorGUILayout.PropertyField(staticEventProp);
|
||
|
break;
|
||
|
case InvokeEvent.InvokeType.DynamicBoolean:
|
||
|
EditorGUILayout.PropertyField(booleanEventProp);
|
||
|
EditorGUILayout.PropertyField(booleanParameterProp);
|
||
|
break;
|
||
|
case InvokeEvent.InvokeType.DynamicInteger:
|
||
|
EditorGUILayout.PropertyField(integerEventProp);
|
||
|
EditorGUILayout.PropertyField(integerParameterProp);
|
||
|
break;
|
||
|
case InvokeEvent.InvokeType.DynamicFloat:
|
||
|
EditorGUILayout.PropertyField(floatEventProp);
|
||
|
EditorGUILayout.PropertyField(floatParameterProp);
|
||
|
break;
|
||
|
case InvokeEvent.InvokeType.DynamicString:
|
||
|
EditorGUILayout.PropertyField(stringEventProp);
|
||
|
EditorGUILayout.PropertyField(stringParameterProp);
|
||
|
break;
|
||
|
}
|
||
9 years ago
|
|
||
8 years ago
|
serializedObject.ApplyModifiedProperties();
|
||
|
}
|
||
|
}
|
||
9 years ago
|
}
|