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.
45 lines
1.7 KiB
45 lines
1.7 KiB
10 years ago
|
using UnityEditor;
|
||
|
using UnityEditorInternal;
|
||
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace Fungus.Script
|
||
|
{
|
||
|
|
||
10 years ago
|
[CustomEditor (typeof(Option))]
|
||
|
public class OptionEditor : FungusCommandEditor
|
||
10 years ago
|
{
|
||
10 years ago
|
public override void DrawCommandGUI()
|
||
10 years ago
|
{
|
||
10 years ago
|
Option t = target as Option;
|
||
10 years ago
|
|
||
|
EditorGUI.BeginChangeCheck();
|
||
|
|
||
|
string optionText = EditorGUILayout.TextField(new GUIContent("Option Text", "Text for option button label"), t.optionText);
|
||
|
Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to execute when option is selected"), t.GetFungusScript(), t.targetSequence);
|
||
10 years ago
|
Option.ShowCondition showCondition = (Option.ShowCondition)EditorGUILayout.EnumPopup(new GUIContent("Show Condition", "Condition when this option should be visible."), t.showCondition);
|
||
10 years ago
|
|
||
10 years ago
|
BooleanVariable booleanVariable = t.booleanVariable;
|
||
10 years ago
|
|
||
10 years ago
|
if (showCondition == Option.ShowCondition.BooleanIsFalse ||
|
||
|
showCondition == Option.ShowCondition.BooleanIsTrue)
|
||
10 years ago
|
{
|
||
10 years ago
|
booleanVariable = FungusVariableEditor.VariableField (new GUIContent ("Boolean Variable", "Boolean variable to test for condition"),
|
||
|
t.GetFungusScript (),
|
||
|
t.booleanVariable,
|
||
|
v => { return v.GetType() == typeof(BooleanVariable); }) as BooleanVariable;
|
||
10 years ago
|
}
|
||
|
|
||
|
if (EditorGUI.EndChangeCheck())
|
||
|
{
|
||
|
Undo.RecordObject(t, "Set Option");
|
||
|
t.optionText = optionText;
|
||
|
t.targetSequence = targetSequence;
|
||
|
t.showCondition = showCondition;
|
||
10 years ago
|
t.booleanVariable = booleanVariable;
|
||
10 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|