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.
54 lines
1.3 KiB
54 lines
1.3 KiB
using UnityEditor; |
|
using UnityEngine; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
|
|
namespace Fungus |
|
{ |
|
[CustomEditor (typeof(Call))] |
|
public class CallEditor : CommandEditor |
|
{ |
|
protected SerializedProperty targetFlowchartProp; |
|
protected SerializedProperty targetBlockProp; |
|
protected SerializedProperty callModeProp; |
|
|
|
protected virtual void OnEnable() |
|
{ |
|
targetFlowchartProp = serializedObject.FindProperty("targetFlowchart"); |
|
targetBlockProp = serializedObject.FindProperty("targetBlock"); |
|
callModeProp = serializedObject.FindProperty("callMode"); |
|
} |
|
|
|
public override void DrawCommandGUI() |
|
{ |
|
serializedObject.Update(); |
|
|
|
Call t = target as Call; |
|
|
|
Flowchart flowchart = null; |
|
if (targetFlowchartProp.objectReferenceValue == null) |
|
{ |
|
flowchart = t.GetFlowchart(); |
|
} |
|
else |
|
{ |
|
flowchart = targetFlowchartProp.objectReferenceValue as Flowchart; |
|
} |
|
|
|
EditorGUILayout.PropertyField(targetFlowchartProp); |
|
|
|
if (flowchart != null) |
|
{ |
|
BlockEditor.BlockField(targetBlockProp, |
|
new GUIContent("Target Block", "Block to call"), |
|
new GUIContent("<None>"), |
|
flowchart); |
|
} |
|
|
|
EditorGUILayout.PropertyField(callModeProp); |
|
|
|
serializedObject.ApplyModifiedProperties(); |
|
} |
|
} |
|
|
|
}
|
|
|