diff --git a/Assets/Fungus/Audio/Commands/PlayMusic.cs b/Assets/Fungus/Audio/Commands/PlayMusic.cs index da7ca3c0..e22dfee0 100644 --- a/Assets/Fungus/Audio/Commands/PlayMusic.cs +++ b/Assets/Fungus/Audio/Commands/PlayMusic.cs @@ -24,7 +24,7 @@ namespace Fungus.Script { if (musicClip == null) { - return "No music clip selected"; + return "Error: No music clip selected"; } return musicClip.name; diff --git a/Assets/Fungus/Audio/Commands/PlaySound.cs b/Assets/Fungus/Audio/Commands/PlaySound.cs index 7f90166c..4c0d9400 100644 --- a/Assets/Fungus/Audio/Commands/PlaySound.cs +++ b/Assets/Fungus/Audio/Commands/PlaySound.cs @@ -27,7 +27,7 @@ namespace Fungus.Script { if (soundClip == null) { - return "No sound clip selected"; + return "Error: No music clip selected"; } return soundClip.name; diff --git a/Assets/Fungus/Camera/Commands/FadeToView.cs b/Assets/Fungus/Camera/Commands/FadeToView.cs index 3568d98d..007a02b2 100644 --- a/Assets/Fungus/Camera/Commands/FadeToView.cs +++ b/Assets/Fungus/Camera/Commands/FadeToView.cs @@ -56,7 +56,7 @@ namespace Fungus.Script { if (targetView == null) { - return ""; + return "Error: No view selected"; } else { diff --git a/Assets/Fungus/Camera/Commands/MoveToView.cs b/Assets/Fungus/Camera/Commands/MoveToView.cs index 4fac7f3d..cd162d91 100644 --- a/Assets/Fungus/Camera/Commands/MoveToView.cs +++ b/Assets/Fungus/Camera/Commands/MoveToView.cs @@ -43,7 +43,7 @@ namespace Fungus.Script { if (targetView == null) { - return ""; + return "Error: No view selected"; } else { diff --git a/Assets/Fungus/Dialog/Commands/AddOption.cs b/Assets/Fungus/Dialog/Commands/AddOption.cs index ba434b6f..8e590487 100644 --- a/Assets/Fungus/Dialog/Commands/AddOption.cs +++ b/Assets/Fungus/Dialog/Commands/AddOption.cs @@ -80,7 +80,11 @@ namespace Fungus.Script public override string GetSummary() { string description = "\"" + optionText + "\""; - if (targetSequence != null) + if (targetSequence == null) + { + description += " "; + } + else { description += " (" + targetSequence.name + ")"; } diff --git a/Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs b/Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs index 01f8252a..94d13f3f 100644 --- a/Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs +++ b/Assets/Fungus/FungusScript/Editor/FungusCommandEditor.cs @@ -34,35 +34,67 @@ namespace Fungus.Script GUILayout.BeginHorizontal(); - if (t.expanded) + bool error = false; + string summary = t.GetSummary().Replace("\n", "").Replace("\r", ""); + if (summary.Length > 80) + { + summary = summary.Substring(0, 80) + "..."; + } + if (summary.StartsWith("Error:")) + { + error = true; + } + + if (!t.enabled) + { + GUI.backgroundColor = Color.grey; + } + else if (error) + { + GUI.backgroundColor = Color.red; + } + else if (t.expanded) { GUI.backgroundColor = Color.yellow; } string commandName = FungusScriptEditor.GetCommandName(t.GetType()); - if (GUILayout.Button(commandName, EditorStyles.miniButton)) + if (GUILayout.Button(commandName, EditorStyles.miniButton, GUILayout.MinWidth(80))) { Undo.RecordObject(t, "Toggle Expanded"); t.expanded = !t.expanded; } GUI.backgroundColor = Color.white; - if (!t.expanded) + GUIStyle labelStyle = new GUIStyle(EditorStyles.whiteMiniLabel); + labelStyle.wordWrap = true; + if (!t.enabled) { - GUIStyle labelStyle = EditorStyles.miniLabel; - labelStyle.wordWrap = true; - string summary = t.GetSummary().Replace("\n", "").Replace("\r", ""); - if (summary.Length > 80) - { - summary = summary.Substring(0, 80) + "..."; - } - GUILayout.Label(summary, labelStyle); - GUILayout.FlexibleSpace(); + labelStyle.normal.textColor = Color.grey; } - else + else if (error) { + labelStyle.normal.textColor = Color.red; + } + + GUILayout.Label(summary, labelStyle); + GUILayout.FlexibleSpace(); + + GUILayout.EndHorizontal(); + + if (t.expanded) + { + GUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + bool enabled = GUILayout.Toggle(t.enabled, ""); + if (t.enabled != enabled) + { + Undo.RecordObject(t, "Set Enabled"); + t.enabled = enabled; + } + if (GUILayout.Button("Up", EditorStyles.miniButtonLeft)) { UnityEditorInternal.ComponentUtility.MoveComponentUp(t); @@ -95,13 +127,8 @@ namespace Fungus.Script Undo.DestroyObjectImmediate(t); return; } - } - GUILayout.EndHorizontal(); - - if (t.expanded) - { - //EditorGUILayout.Separator(); + GUILayout.EndHorizontal(); DrawCommandGUI(); diff --git a/Assets/Fungus/FungusScript/Scripts/If.cs b/Assets/Fungus/FungusScript/Scripts/If.cs index 5f1486c7..5492eda4 100644 --- a/Assets/Fungus/FungusScript/Scripts/If.cs +++ b/Assets/Fungus/FungusScript/Scripts/If.cs @@ -166,7 +166,7 @@ namespace Fungus.Script { if (variable == null) { - return "No variable selected"; + return "Error: No variable selected"; } string summary = variable.key; diff --git a/Assets/Fungus/FungusScript/Scripts/Sequence.cs b/Assets/Fungus/FungusScript/Scripts/Sequence.cs index d4eb076f..2a0b8cb0 100644 --- a/Assets/Fungus/FungusScript/Scripts/Sequence.cs +++ b/Assets/Fungus/FungusScript/Scripts/Sequence.cs @@ -96,8 +96,11 @@ namespace Fungus.Script } else if (executeNext) { - nextCommand = command; - break; + if (command.enabled) + { + nextCommand = command; + break; + } } } diff --git a/Assets/Fungus/FungusScript/Scripts/Set.cs b/Assets/Fungus/FungusScript/Scripts/Set.cs index e6ea603a..652718a3 100644 --- a/Assets/Fungus/FungusScript/Scripts/Set.cs +++ b/Assets/Fungus/FungusScript/Scripts/Set.cs @@ -123,7 +123,7 @@ namespace Fungus.Script { if (variable == null) { - return ""; + return "Error: Variable not selected"; } string description = variable.key; diff --git a/Assets/Fungus/Sprite/Commands/FadeSprite.cs b/Assets/Fungus/Sprite/Commands/FadeSprite.cs index d90a3476..1c898356 100644 --- a/Assets/Fungus/Sprite/Commands/FadeSprite.cs +++ b/Assets/Fungus/Sprite/Commands/FadeSprite.cs @@ -8,8 +8,8 @@ namespace Fungus.Script [HelpText("Fades a sprite to a target color over a period of time.")] public class FadeSprite : FungusCommand { - public float duration; public SpriteRenderer spriteRenderer; + public float duration; public Color targetColor = Color.white; public bool waitUntilFinished = true; @@ -35,6 +35,16 @@ namespace Fungus.Script Continue(); } } + + public override string GetSummary() + { + if (spriteRenderer == null) + { + return "Error: No sprite renderer selected"; + } + + return spriteRenderer.name + " to " + targetColor.ToString(); + } } } \ No newline at end of file diff --git a/Assets/Shuttle/ShuttleGame.unity b/Assets/Shuttle/ShuttleGame.unity index d79160d6..bb52109a 100644 Binary files a/Assets/Shuttle/ShuttleGame.unity and b/Assets/Shuttle/ShuttleGame.unity differ