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.
47 lines
1.6 KiB
47 lines
1.6 KiB
11 years ago
|
using UnityEditor;
|
||
11 years ago
|
using UnityEditorInternal;
|
||
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
11 years ago
|
namespace Fungus.Script
|
||
11 years ago
|
{
|
||
|
|
||
11 years ago
|
[CustomEditor (typeof(AddOption))]
|
||
11 years ago
|
public class AddOptionEditor : FungusCommandEditor
|
||
11 years ago
|
{
|
||
|
public override void DrawCommandInspectorGUI()
|
||
|
{
|
||
11 years ago
|
AddOption t = target as AddOption;
|
||
11 years ago
|
|
||
|
EditorGUI.BeginChangeCheck();
|
||
|
|
||
|
string newText = EditorGUILayout.TextField(new GUIContent("Text", "Text to display on option button"), t.text);
|
||
|
Sequence newSequence = SequenceEditor.SequenceField(new GUIContent("Sequence", "Sequence to execute when this option is selected"),
|
||
11 years ago
|
t.GetFungusScript(),
|
||
11 years ago
|
t.sequence);
|
||
11 years ago
|
AddOption.Condition newCondition = (AddOption.Condition)EditorGUILayout.EnumPopup(new GUIContent("Condition", "Conditions for when this option is displayed"), t.condition);
|
||
11 years ago
|
|
||
|
if (EditorGUI.EndChangeCheck())
|
||
|
{
|
||
|
Undo.RecordObject(t, "Set AddOption command");
|
||
|
|
||
|
t.text = newText;
|
||
|
t.sequence = newSequence;
|
||
|
t.condition = newCondition;
|
||
|
}
|
||
|
|
||
11 years ago
|
if (t.condition == AddOption.Condition.ShowOnBoolean ||
|
||
|
t.condition == AddOption.Condition.HideOnBoolean)
|
||
11 years ago
|
{
|
||
|
string newBooleanVariableKey = EditorGUILayout.TextField(new GUIContent("Boolean Variable Key", "Boolean variable to check for condition"), t.booleanVariableKey);
|
||
|
if (newBooleanVariableKey != t.booleanVariableKey)
|
||
|
{
|
||
|
Undo.RecordObject(t, "Set Boolean Variable");
|
||
|
t.booleanVariableKey = newBooleanVariableKey;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|