diff --git a/Assets/Fungus/FungusScript/Scripts/Command.cs b/Assets/Fungus/FungusScript/Scripts/Command.cs index 08e2d73e..3fcf0e79 100644 --- a/Assets/Fungus/FungusScript/Scripts/Command.cs +++ b/Assets/Fungus/FungusScript/Scripts/Command.cs @@ -8,6 +8,13 @@ namespace Fungus public class CommandInfoAttribute : Attribute { + /** + * Metadata atribute for the Command class. + * @param category The category to place this command in. + * @param commandName The display name of the command. + * @param helpText Help information to display in the inspector. + * @param priority If two command classes have the same name, the one with highest priority is listed. Negative priority removess the command from the list. + */ public CommandInfoAttribute(string category, string commandName, string helpText, int priority = 0) { this.Category = category; diff --git a/Assets/Fungus/FungusScript/Scripts/Commands/Else.cs b/Assets/Fungus/FungusScript/Scripts/Commands/Else.cs index c730af89..e6ece951 100644 --- a/Assets/Fungus/FungusScript/Scripts/Commands/Else.cs +++ b/Assets/Fungus/FungusScript/Scripts/Commands/Else.cs @@ -17,7 +17,7 @@ namespace Fungus return; } - // Find the next EndIf command at the same indent level as this Else command + // Find the next End command at the same indent level as this Else command bool foundThisCommand = false; int indent = indentLevel; foreach(Command command in parentSequence.commandList) @@ -26,7 +26,8 @@ namespace Fungus command.indentLevel == indent) { System.Type type = command.GetType(); - if (type == typeof(EndIf)) + if (type == typeof(EndIf) || // Legacy support for old EndIf command + type == typeof(End)) { // Execute command immediately after the EndIf command Continue(command); diff --git a/Assets/Fungus/FungusScript/Scripts/Commands/End.cs b/Assets/Fungus/FungusScript/Scripts/Commands/End.cs new file mode 100644 index 00000000..2a795d2a --- /dev/null +++ b/Assets/Fungus/FungusScript/Scripts/Commands/End.cs @@ -0,0 +1,29 @@ +using UnityEngine; +using System.Collections; +using System.Collections.Generic; + +namespace Fungus +{ + [CommandInfo("Scripting", + "End", + "Marks the end of a conditional block.")] + [AddComponentMenu("")] + public class End : Command + { + public override void OnEnter() + { + Continue(); + } + + public override int GetPreIndent() + { + return -1; + } + + public override Color GetButtonColor() + { + return new Color32(253, 253, 150, 255); + } + } + +} \ No newline at end of file diff --git a/Assets/Fungus/FungusScript/Scripts/Commands/End.cs.meta b/Assets/Fungus/FungusScript/Scripts/Commands/End.cs.meta new file mode 100644 index 00000000..b2c4160f --- /dev/null +++ b/Assets/Fungus/FungusScript/Scripts/Commands/End.cs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 93cb9773f2ca04e2bbf7a68ccfc23267 +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: diff --git a/Assets/Fungus/FungusScript/Scripts/Commands/EndIf.cs b/Assets/Fungus/FungusScript/Scripts/Commands/EndIf.cs index 0af90017..3280f1b0 100644 --- a/Assets/Fungus/FungusScript/Scripts/Commands/EndIf.cs +++ b/Assets/Fungus/FungusScript/Scripts/Commands/EndIf.cs @@ -4,9 +4,10 @@ using System.Collections.Generic; namespace Fungus { + // Note: The End If command is deprecated, use the End command instead. [CommandInfo("Scripting", - "End If", - "Marks the end of an If statement block.")] + "End", + "Marks the end of a conditional block.", -1)] [AddComponentMenu("")] public class EndIf : Command { diff --git a/Assets/Fungus/FungusScript/Scripts/Commands/If.cs b/Assets/Fungus/FungusScript/Scripts/Commands/If.cs index 1aff6bb7..99441ee1 100644 --- a/Assets/Fungus/FungusScript/Scripts/Commands/If.cs +++ b/Assets/Fungus/FungusScript/Scripts/Commands/If.cs @@ -156,7 +156,8 @@ namespace Fungus { System.Type type = command.GetType(); if (type == typeof(Else) || - type == typeof(EndIf)) + type == typeof(EndIf) || // Legacy support for old EndIf command + type == typeof(End)) { // Execute command immediately after the Else or EndIf command Continue(command); @@ -169,7 +170,7 @@ namespace Fungus } } - // No matching EndIf command found, so just stop the sequence + // No matching End command found, so just stop the sequence Stop(); } }