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.
62 lines
2.1 KiB
62 lines
2.1 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
|
|
||
10 years ago
|
using UnityEditor;
|
||
|
using UnityEngine;
|
||
|
|
||
10 years ago
|
namespace Fungus
|
||
10 years ago
|
{
|
||
8 years ago
|
[CustomEditor (typeof(Call))]
|
||
|
public class CallEditor : CommandEditor
|
||
|
{
|
||
|
protected SerializedProperty targetFlowchartProp;
|
||
|
protected SerializedProperty targetBlockProp;
|
||
|
protected SerializedProperty startIndexProp;
|
||
|
protected SerializedProperty callModeProp;
|
||
10 years ago
|
|
||
8 years ago
|
protected virtual void OnEnable()
|
||
|
{
|
||
|
if (NullTargetCheck()) // Check for an orphaned editor instance
|
||
|
return;
|
||
9 years ago
|
|
||
8 years ago
|
targetFlowchartProp = serializedObject.FindProperty("targetFlowchart");
|
||
|
targetBlockProp = serializedObject.FindProperty("targetBlock");
|
||
|
startIndexProp = serializedObject.FindProperty("startIndex");
|
||
|
callModeProp = serializedObject.FindProperty("callMode");
|
||
|
}
|
||
10 years ago
|
|
||
8 years ago
|
public override void DrawCommandGUI()
|
||
|
{
|
||
|
serializedObject.Update();
|
||
10 years ago
|
|
||
8 years ago
|
Call t = target as Call;
|
||
10 years ago
|
|
||
8 years ago
|
Flowchart flowchart = null;
|
||
|
if (targetFlowchartProp.objectReferenceValue == null)
|
||
|
{
|
||
|
flowchart = t.GetFlowchart();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
flowchart = targetFlowchartProp.objectReferenceValue as Flowchart;
|
||
|
}
|
||
10 years ago
|
|
||
8 years ago
|
EditorGUILayout.PropertyField(targetFlowchartProp);
|
||
10 years ago
|
|
||
8 years ago
|
if (flowchart != null)
|
||
|
{
|
||
|
BlockEditor.BlockField(targetBlockProp,
|
||
|
new GUIContent("Target Block", "Block to call"),
|
||
|
new GUIContent("<None>"),
|
||
|
flowchart);
|
||
9 years ago
|
|
||
8 years ago
|
EditorGUILayout.PropertyField(startIndexProp);
|
||
|
}
|
||
10 years ago
|
|
||
8 years ago
|
EditorGUILayout.PropertyField(callModeProp);
|
||
10 years ago
|
|
||
8 years ago
|
serializedObject.ApplyModifiedProperties();
|
||
|
}
|
||
|
}
|
||
10 years ago
|
}
|