diff --git a/Assets/Fungus/Editor/FungusScript/CallEditor.cs b/Assets/Fungus/Editor/FungusScript/CallEditor.cs index f3a16099..566ddfa6 100644 --- a/Assets/Fungus/Editor/FungusScript/CallEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/CallEditor.cs @@ -30,7 +30,10 @@ namespace Fungus.Script if (t.callCondition == CallCondition.CallAlways) { - Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to call"), t.GetFungusScript(), t.targetSequence); + Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to call"), + new GUIContent(""), + t.GetFungusScript(), + t.targetSequence); if (targetSequence != t.targetSequence) { Undo.RecordObject(t, "Set Target Sequence"); @@ -39,7 +42,7 @@ namespace Fungus.Script return; } - FungusVariable fungusVariable = FungusVariableEditor.VariableField(new GUIContent("Compare Variable", "Variable to use in compare operation"), + FungusVariable fungusVariable = FungusVariableEditor.VariableField(new GUIContent("Variable", "Variable to use in operation"), t.GetFungusScript(), t.variable, null); @@ -95,10 +98,12 @@ namespace Fungus.Script } Sequence onTrue = SequenceEditor.SequenceField(new GUIContent("On True Sequence", "Sequence to execute if comparision is true"), + new GUIContent(""), t.GetFungusScript(), t.onTrueSequence); Sequence onFalse = SequenceEditor.SequenceField(new GUIContent("On False Sequence", "Sequence to execute if comparision is false"), + new GUIContent(""), t.GetFungusScript(), t.onFalseSequence); diff --git a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs index c55521e9..7bfc17aa 100644 --- a/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/FungusScriptEditor.cs @@ -38,12 +38,14 @@ namespace Fungus.Script FungusScript t = target as FungusScript; - GUIContent stepTimeLabel = new GUIContent("Step Time", "Minimum time to execute each step"); - t.stepTime = EditorGUILayout.FloatField(stepTimeLabel, t.stepTime); - - GUIContent startSequenceLabel = new GUIContent("Start Sequence", "Sequence to be executed when controller starts."); - t.startSequence = SequenceEditor.SequenceField(startSequenceLabel, t, t.startSequence); + float stepTime = EditorGUILayout.FloatField(new GUIContent("Step Time", "Minimum time to execute each step"), t.stepTime); + + EditorGUI.BeginChangeCheck(); + Sequence startSequence = SequenceEditor.SequenceField(new GUIContent("Start Sequence", "Sequence to be executed when controller starts."), + new GUIContent(""), + t, + t.startSequence); if (t.startSequence == null) { GUIStyle style = new GUIStyle(GUI.skin.label); @@ -51,8 +53,17 @@ namespace Fungus.Script EditorGUILayout.LabelField(new GUIContent("Error: Please select a Start Sequence"), style); } - GUIContent startAutomaticallyLabel = new GUIContent("Start Automatically", "Start this Fungus Script when the scene starts."); - t.startAutomatically = EditorGUILayout.Toggle(startAutomaticallyLabel, t.startAutomatically); + bool startAutomatically = EditorGUILayout.Toggle(new GUIContent("Start Automatically", "Start this Fungus Script when the scene starts."), t.startAutomatically); + + if (EditorGUI.EndChangeCheck()) + { + Undo.RecordObject(t, "Set Fungus Script"); + t.stepTime = stepTime; + t.startSequence = startSequence; + t.startAutomatically = startAutomatically; + } + + EditorGUILayout.Separator(); GUILayout.BeginHorizontal(); GUILayout.FlexibleSpace(); diff --git a/Assets/Fungus/Editor/FungusScript/OptionEditor.cs b/Assets/Fungus/Editor/FungusScript/OptionEditor.cs index d9351842..5dec7e6d 100644 --- a/Assets/Fungus/Editor/FungusScript/OptionEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/OptionEditor.cs @@ -17,7 +17,10 @@ namespace Fungus.Script 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); + Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to execute when option is selected"), + new GUIContent(""), + t.GetFungusScript(), + t.targetSequence); Option.ShowCondition showCondition = (Option.ShowCondition)EditorGUILayout.EnumPopup(new GUIContent("Show Condition", "Condition when this option should be visible."), t.showCondition); BooleanVariable booleanVariable = t.booleanVariable; diff --git a/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs b/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs index 3bb10186..87f0cf45 100644 --- a/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs +++ b/Assets/Fungus/Editor/FungusScript/SequenceEditor.cs @@ -10,9 +10,7 @@ namespace Fungus.Script [CustomEditor (typeof(Sequence))] public class SequenceEditor : Editor { - // FungusCommand activeCommand; - - static public Sequence SequenceField(GUIContent label, FungusScript fungusScript, Sequence sequence) + static public Sequence SequenceField(GUIContent label, GUIContent nullLabel, FungusScript fungusScript, Sequence sequence) { if (fungusScript == null) { @@ -25,7 +23,7 @@ namespace Fungus.Script List sequenceNames = new List(); int selectedIndex = 0; - sequenceNames.Add(new GUIContent("")); + sequenceNames.Add(nullLabel); Sequence[] sequences = fungusScript.GetComponentsInChildren(); for (int i = 0; i < sequences.Length; ++i) { diff --git a/Assets/Fungus/VisualScripting/Call.cs b/Assets/Fungus/VisualScripting/Call.cs index a1a6538b..85346253 100644 --- a/Assets/Fungus/VisualScripting/Call.cs +++ b/Assets/Fungus/VisualScripting/Call.cs @@ -7,7 +7,7 @@ namespace Fungus.Script public enum CallCondition { CallAlways, - CallOnCompare + CallIf } public enum CompareOperator @@ -202,7 +202,7 @@ namespace Fungus.Script if (onTrueSequence == null) { - description += ""; + description += ""; } else { @@ -211,7 +211,7 @@ namespace Fungus.Script description += " else "; if (onFalseSequence == null) { - description += ""; + description += ""; } else { diff --git a/Assets/Fungus/VisualScripting/Option.cs b/Assets/Fungus/VisualScripting/Option.cs index eccf3725..1acceb4c 100644 --- a/Assets/Fungus/VisualScripting/Option.cs +++ b/Assets/Fungus/VisualScripting/Option.cs @@ -76,10 +76,14 @@ namespace Fungus.Script } } - public override string GetDescription() { - return "\"" + optionText + "\""; + string description = "\"" + optionText + "\""; + if (targetSequence != null) + { + description += " (" + targetSequence.name + ")"; + } + return description; } } diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index 00e675f8..edd44b75 100644 Binary files a/Assets/Shuttle/ShuttleGame.unity and b/Assets/Shuttle/ShuttleGame.unity differ