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
using UnityEditor; |
|
using UnityEditorInternal; |
|
using UnityEngine; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
|
|
namespace Fungus |
|
{ |
|
|
|
[CustomEditor (typeof(AddOptionCommand))] |
|
public class AddOptionCommandEditor : FungusCommandEditor |
|
{ |
|
public override void DrawCommandInspectorGUI() |
|
{ |
|
AddOptionCommand t = target as AddOptionCommand; |
|
|
|
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"), |
|
t.GetParentFungusScript(), |
|
t.sequence); |
|
AddOptionCommand.Condition newCondition = (AddOptionCommand.Condition)EditorGUILayout.EnumPopup(new GUIContent("Condition", "Conditions for when this option is displayed"), t.condition); |
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
{ |
|
Undo.RecordObject(t, "Set AddOption command"); |
|
|
|
t.text = newText; |
|
t.sequence = newSequence; |
|
t.condition = newCondition; |
|
} |
|
|
|
if (t.condition == AddOptionCommand.Condition.ShowOnBoolean || |
|
t.condition == AddOptionCommand.Condition.HideOnBoolean) |
|
{ |
|
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; |
|
} |
|
} |
|
} |
|
} |
|
|
|
} |