|
|
@ -159,8 +159,9 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
// Tell all components that implement IUpdateable to update to the new version |
|
|
|
// Tell all components that implement IUpdateable to update to the new version |
|
|
|
var components = GetComponents<Component>(); |
|
|
|
var components = GetComponents<Component>(); |
|
|
|
foreach (var component in components) |
|
|
|
for (int i = 0; i < components.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var component = components[i]; |
|
|
|
IUpdateable u = component as IUpdateable; |
|
|
|
IUpdateable u = component as IUpdateable; |
|
|
|
if (u != null) |
|
|
|
if (u != null) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -182,10 +183,10 @@ namespace Fungus |
|
|
|
// This should always be the case, but some legacy Flowcharts may have issues. |
|
|
|
// This should always be the case, but some legacy Flowcharts may have issues. |
|
|
|
List<int> usedIds = new List<int>(); |
|
|
|
List<int> usedIds = new List<int>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int i = 0; i < blocks.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (block.ItemId == -1 || |
|
|
|
var block = blocks[i]; |
|
|
|
usedIds.Contains(block.ItemId)) |
|
|
|
if (block.ItemId == -1 || usedIds.Contains(block.ItemId)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
block.ItemId = NextItemId(); |
|
|
|
block.ItemId = NextItemId(); |
|
|
|
} |
|
|
|
} |
|
|
@ -193,10 +194,10 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
foreach (var command in commands) |
|
|
|
for (int i = 0; i < commands.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (command.ItemId == -1 || |
|
|
|
var command = commands[i]; |
|
|
|
usedIds.Contains(command.ItemId)) |
|
|
|
if (command.ItemId == -1 || usedIds.Contains(command.ItemId)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
command.ItemId = NextItemId(); |
|
|
|
command.ItemId = NextItemId(); |
|
|
|
} |
|
|
|
} |
|
|
@ -215,8 +216,9 @@ namespace Fungus |
|
|
|
variables.RemoveAll(item => item == null); |
|
|
|
variables.RemoveAll(item => item == null); |
|
|
|
|
|
|
|
|
|
|
|
var allVariables = GetComponents<Variable>(); |
|
|
|
var allVariables = GetComponents<Variable>(); |
|
|
|
foreach (var variable in allVariables) |
|
|
|
for (int i = 0; i < allVariables.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var variable = allVariables[i]; |
|
|
|
if (!variables.Contains(variable)) |
|
|
|
if (!variables.Contains(variable)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DestroyImmediate(variable); |
|
|
|
DestroyImmediate(variable); |
|
|
@ -225,18 +227,19 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
foreach (var command in commands) |
|
|
|
for (int i = 0; i < commands.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var command = commands[i]; |
|
|
|
bool found = false; |
|
|
|
bool found = false; |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int j = 0; j < blocks.Length; j++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var block = blocks[j]; |
|
|
|
if (block.CommandList.Contains(command)) |
|
|
|
if (block.CommandList.Contains(command)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
found = true; |
|
|
|
found = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!found) |
|
|
|
if (!found) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DestroyImmediate(command); |
|
|
|
DestroyImmediate(command); |
|
|
@ -244,18 +247,19 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var eventHandlers = GetComponents<EventHandler>(); |
|
|
|
var eventHandlers = GetComponents<EventHandler>(); |
|
|
|
foreach (var eventHandler in eventHandlers) |
|
|
|
for (int i = 0; i < eventHandlers.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var eventHandler = eventHandlers[i]; |
|
|
|
bool found = false; |
|
|
|
bool found = false; |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int j = 0; j < blocks.Length; j++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var block = blocks[j]; |
|
|
|
if (block._EventHandler == eventHandler) |
|
|
|
if (block._EventHandler == eventHandler) |
|
|
|
{ |
|
|
|
{ |
|
|
|
found = true; |
|
|
|
found = true; |
|
|
|
break; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!found) |
|
|
|
if (!found) |
|
|
|
{ |
|
|
|
{ |
|
|
|
DestroyImmediate(eventHandler); |
|
|
|
DestroyImmediate(eventHandler); |
|
|
@ -283,8 +287,9 @@ namespace Fungus |
|
|
|
public static void BroadcastFungusMessage(string messageName) |
|
|
|
public static void BroadcastFungusMessage(string messageName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var eventHandlers = UnityEngine.Object.FindObjectsOfType<MessageReceived>(); |
|
|
|
var eventHandlers = UnityEngine.Object.FindObjectsOfType<MessageReceived>(); |
|
|
|
foreach (var eventHandler in eventHandlers) |
|
|
|
for (int i = 0; i < eventHandlers.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var eventHandler = eventHandlers[i]; |
|
|
|
eventHandler.OnSendFungusMessage(messageName); |
|
|
|
eventHandler.OnSendFungusMessage(messageName); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -409,14 +414,16 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
int maxId = -1; |
|
|
|
int maxId = -1; |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int i = 0; i < blocks.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var block = blocks[i]; |
|
|
|
maxId = Math.Max(maxId, block.ItemId); |
|
|
|
maxId = Math.Max(maxId, block.ItemId); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
foreach (var command in commands) |
|
|
|
for (int i = 0; i < commands.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var command = commands[i]; |
|
|
|
maxId = Math.Max(maxId, command.ItemId); |
|
|
|
maxId = Math.Max(maxId, command.ItemId); |
|
|
|
} |
|
|
|
} |
|
|
|
return maxId + 1; |
|
|
|
return maxId + 1; |
|
|
@ -441,8 +448,9 @@ namespace Fungus |
|
|
|
public virtual Block FindBlock(string blockName) |
|
|
|
public virtual Block FindBlock(string blockName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int i = 0; i < blocks.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var block = blocks[i]; |
|
|
|
if (block.BlockName == blockName) |
|
|
|
if (block.BlockName == blockName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return block; |
|
|
|
return block; |
|
|
@ -509,8 +517,9 @@ namespace Fungus |
|
|
|
public virtual void StopAllBlocks() |
|
|
|
public virtual void StopAllBlocks() |
|
|
|
{ |
|
|
|
{ |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int i = 0; i < blocks.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var block = blocks[i]; |
|
|
|
if (block.IsExecuting()) |
|
|
|
if (block.IsExecuting()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
block.Stop(); |
|
|
|
block.Stop(); |
|
|
@ -525,8 +534,9 @@ namespace Fungus |
|
|
|
public virtual void SendFungusMessage(string messageName) |
|
|
|
public virtual void SendFungusMessage(string messageName) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var eventHandlers = GetComponents<MessageReceived>(); |
|
|
|
var eventHandlers = GetComponents<MessageReceived>(); |
|
|
|
foreach (var eventHandler in eventHandlers) |
|
|
|
for (int i = 0; i < eventHandlers.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var eventHandler = eventHandlers[i]; |
|
|
|
eventHandler.OnSendFungusMessage(messageName); |
|
|
|
eventHandler.OnSendFungusMessage(messageName); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -556,15 +566,13 @@ namespace Fungus |
|
|
|
while (true) |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool collision = false; |
|
|
|
bool collision = false; |
|
|
|
foreach(var variable in variables) |
|
|
|
for (int i = 0; i < variables.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (variable == null || |
|
|
|
var variable = variables[i]; |
|
|
|
variable == ignoreVariable || |
|
|
|
if (variable == null || variable == ignoreVariable || variable.Key == null) |
|
|
|
variable.Key == null) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (variable.Key.Equals(key, StringComparison.CurrentCultureIgnoreCase)) |
|
|
|
if (variable.Key.Equals(key, StringComparison.CurrentCultureIgnoreCase)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
collision = true; |
|
|
|
collision = true; |
|
|
@ -600,14 +608,13 @@ namespace Fungus |
|
|
|
while (true) |
|
|
|
while (true) |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool collision = false; |
|
|
|
bool collision = false; |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int i = 0; i < blocks.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (block == ignoreBlock || |
|
|
|
var block = blocks[i]; |
|
|
|
block.BlockName == null) |
|
|
|
if (block == ignoreBlock || block.BlockName == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (block.BlockName.Equals(key, StringComparison.CurrentCultureIgnoreCase)) |
|
|
|
if (block.BlockName.Equals(key, StringComparison.CurrentCultureIgnoreCase)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
collision = true; |
|
|
|
collision = true; |
|
|
@ -644,15 +651,14 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
bool collision = false; |
|
|
|
bool collision = false; |
|
|
|
var commandList = block.CommandList; |
|
|
|
var commandList = block.CommandList; |
|
|
|
foreach (var command in commandList) |
|
|
|
for (int i = 0; i < commandList.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var command = commandList[i]; |
|
|
|
Label label = command as Label; |
|
|
|
Label label = command as Label; |
|
|
|
if (label == null || |
|
|
|
if (label == null || label == ignoreLabel) |
|
|
|
label == ignoreLabel) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (label.Key.Equals(key, StringComparison.CurrentCultureIgnoreCase)) |
|
|
|
if (label.Key.Equals(key, StringComparison.CurrentCultureIgnoreCase)) |
|
|
|
{ |
|
|
|
{ |
|
|
|
collision = true; |
|
|
|
collision = true; |
|
|
@ -677,8 +683,9 @@ namespace Fungus |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public Variable GetVariable(string key) |
|
|
|
public Variable GetVariable(string key) |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach (var variable in variables) |
|
|
|
for (int i = 0; i < variables.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var variable = variables[i]; |
|
|
|
if (variable != null && variable.Key == key) |
|
|
|
if (variable != null && variable.Key == key) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return variable; |
|
|
|
return variable; |
|
|
@ -696,8 +703,9 @@ namespace Fungus |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public T GetVariable<T>(string key) where T : Variable |
|
|
|
public T GetVariable<T>(string key) where T : Variable |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach (var variable in variables) |
|
|
|
for (int i = 0; i < variables.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var variable = variables[i]; |
|
|
|
if (variable != null && variable.Key == key) |
|
|
|
if (variable != null && variable.Key == key) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return variable as T; |
|
|
|
return variable as T; |
|
|
@ -714,8 +722,9 @@ namespace Fungus |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public void SetVariable<T>(string key, T newvariable) where T : Variable |
|
|
|
public void SetVariable<T>(string key, T newvariable) where T : Variable |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach (var v in variables) |
|
|
|
for (int i = 0; i < variables.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var v = variables[i]; |
|
|
|
if (v != null && v.Key == key) |
|
|
|
if (v != null && v.Key == key) |
|
|
|
{ |
|
|
|
{ |
|
|
|
T variable = v as T; |
|
|
|
T variable = v as T; |
|
|
@ -735,9 +744,10 @@ namespace Fungus |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public virtual List<Variable> GetPublicVariables() |
|
|
|
public virtual List<Variable> GetPublicVariables() |
|
|
|
{ |
|
|
|
{ |
|
|
|
List<Variable> publicVariables = new List<Variable>(); |
|
|
|
var publicVariables = new List<Variable>(); |
|
|
|
foreach (var v in variables) |
|
|
|
for (int i = 0; i < variables.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var v = variables[i]; |
|
|
|
if (v != null && v.Scope == VariableScope.Public) |
|
|
|
if (v != null && v.Scope == VariableScope.Public) |
|
|
|
{ |
|
|
|
{ |
|
|
|
publicVariables.Add(v); |
|
|
|
publicVariables.Add(v); |
|
|
@ -879,8 +889,9 @@ namespace Fungus |
|
|
|
if (hideComponents) |
|
|
|
if (hideComponents) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int i = 0; i < blocks.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var block = blocks[i]; |
|
|
|
block.hideFlags = HideFlags.HideInInspector; |
|
|
|
block.hideFlags = HideFlags.HideInInspector; |
|
|
|
if (block.gameObject != gameObject) |
|
|
|
if (block.gameObject != gameObject) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -889,27 +900,29 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
foreach (var command in commands) |
|
|
|
for (int i = 0; i < commands.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var command = commands[i]; |
|
|
|
command.hideFlags = HideFlags.HideInInspector; |
|
|
|
command.hideFlags = HideFlags.HideInInspector; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var eventHandlers = GetComponents<EventHandler>(); |
|
|
|
var eventHandlers = GetComponents<EventHandler>(); |
|
|
|
foreach (var eventHandler in eventHandlers) |
|
|
|
for (int i = 0; i < eventHandlers.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var eventHandler = eventHandlers[i]; |
|
|
|
eventHandler.hideFlags = HideFlags.HideInInspector; |
|
|
|
eventHandler.hideFlags = HideFlags.HideInInspector; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
var monoBehaviours = GetComponents<MonoBehaviour>(); |
|
|
|
var monoBehaviours = GetComponents<MonoBehaviour>(); |
|
|
|
foreach (var monoBehaviour in monoBehaviours) |
|
|
|
for (int i = 0; i < monoBehaviours.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var monoBehaviour = monoBehaviours[i]; |
|
|
|
if (monoBehaviour == null) |
|
|
|
if (monoBehaviour == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
monoBehaviour.hideFlags = HideFlags.None; |
|
|
|
monoBehaviour.hideFlags = HideFlags.None; |
|
|
|
monoBehaviour.gameObject.hideFlags = HideFlags.None; |
|
|
|
monoBehaviour.gameObject.hideFlags = HideFlags.None; |
|
|
|
} |
|
|
|
} |
|
|
@ -943,16 +956,18 @@ namespace Fungus |
|
|
|
if (resetCommands) |
|
|
|
if (resetCommands) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
var commands = GetComponents<Command>(); |
|
|
|
foreach (var command in commands) |
|
|
|
for (int i = 0; i < commands.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var command = commands[i]; |
|
|
|
command.OnReset(); |
|
|
|
command.OnReset(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (resetVariables) |
|
|
|
if (resetVariables) |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach (var variable in variables) |
|
|
|
for (int i = 0; i < variables.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var variable = variables[i]; |
|
|
|
variable.OnReset(); |
|
|
|
variable.OnReset(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -963,11 +978,11 @@ namespace Fungus |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
|
public virtual bool IsCommandSupported(CommandInfoAttribute commandInfo) |
|
|
|
public virtual bool IsCommandSupported(CommandInfoAttribute commandInfo) |
|
|
|
{ |
|
|
|
{ |
|
|
|
foreach (var key in hideCommands) |
|
|
|
for (int i = 0; i < hideCommands.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// Match on category or command name (case insensitive) |
|
|
|
// Match on category or command name (case insensitive) |
|
|
|
if (String.Compare(commandInfo.Category, key, StringComparison.OrdinalIgnoreCase) == 0 || |
|
|
|
var key = hideCommands[i]; |
|
|
|
String.Compare(commandInfo.CommandName, key, StringComparison.OrdinalIgnoreCase) == 0) |
|
|
|
if (String.Compare(commandInfo.Category, key, StringComparison.OrdinalIgnoreCase) == 0 || String.Compare(commandInfo.CommandName, key, StringComparison.OrdinalIgnoreCase) == 0) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
@ -982,8 +997,9 @@ namespace Fungus |
|
|
|
public virtual bool HasExecutingBlocks() |
|
|
|
public virtual bool HasExecutingBlocks() |
|
|
|
{ |
|
|
|
{ |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int i = 0; i < blocks.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var block = blocks[i]; |
|
|
|
if (block.IsExecuting()) |
|
|
|
if (block.IsExecuting()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -999,8 +1015,9 @@ namespace Fungus |
|
|
|
{ |
|
|
|
{ |
|
|
|
var executingBlocks = new List<Block>(); |
|
|
|
var executingBlocks = new List<Block>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
var blocks = GetComponents<Block>(); |
|
|
|
foreach (var block in blocks) |
|
|
|
for (int i = 0; i < blocks.Length; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var block = blocks[i]; |
|
|
|
if (block.IsExecuting()) |
|
|
|
if (block.IsExecuting()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
executingBlocks.Add(block); |
|
|
|
executingBlocks.Add(block); |
|
|
@ -1036,18 +1053,17 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
// Match the regular expression pattern against a text string. |
|
|
|
// Match the regular expression pattern against a text string. |
|
|
|
var results = r.Matches(input); |
|
|
|
var results = r.Matches(input); |
|
|
|
foreach (Match match in results) |
|
|
|
for (int i = 0; i < results.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Match match = results[i]; |
|
|
|
string key = match.Value.Substring(2, match.Value.Length - 3); |
|
|
|
string key = match.Value.Substring(2, match.Value.Length - 3); |
|
|
|
|
|
|
|
|
|
|
|
// Look for any matching private variables in this Flowchart first |
|
|
|
// Look for any matching private variables in this Flowchart first |
|
|
|
foreach (var variable in variables) |
|
|
|
for (int j = 0; j < variables.Count; j++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var variable = variables[j]; |
|
|
|
if (variable == null) |
|
|
|
if (variable == null) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
if (variable.Scope == VariableScope.Private && variable.Key == key) |
|
|
|
if (variable.Scope == VariableScope.Private && |
|
|
|
|
|
|
|
variable.Key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
string value = variable.ToString(); |
|
|
|
string value = variable.ToString(); |
|
|
|
sb.Replace(match.Value, value); |
|
|
|
sb.Replace(match.Value, value); |
|
|
@ -1088,22 +1104,22 @@ namespace Fungus |
|
|
|
|
|
|
|
|
|
|
|
// Match the regular expression pattern against a text string. |
|
|
|
// Match the regular expression pattern against a text string. |
|
|
|
var results = r.Matches(input.ToString()); |
|
|
|
var results = r.Matches(input.ToString()); |
|
|
|
foreach (Match match in results) |
|
|
|
for (int i = 0; i < results.Count; i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
Match match = results[i]; |
|
|
|
string key = match.Value.Substring(2, match.Value.Length - 3); |
|
|
|
string key = match.Value.Substring(2, match.Value.Length - 3); |
|
|
|
|
|
|
|
|
|
|
|
// Look for any matching public variables in this Flowchart |
|
|
|
// Look for any matching public variables in this Flowchart |
|
|
|
foreach (var variable in variables) |
|
|
|
for (int j = 0; j < variables.Count; j++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var variable = variables[j]; |
|
|
|
if (variable == null) |
|
|
|
if (variable == null) |
|
|
|
|
|
|
|
{ |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
if (variable.Scope == VariableScope.Public && |
|
|
|
if (variable.Scope == VariableScope.Public && variable.Key == key) |
|
|
|
variable.Key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
string value = variable.ToString(); |
|
|
|
string value = variable.ToString(); |
|
|
|
input.Replace(match.Value, value); |
|
|
|
input.Replace(match.Value, value); |
|
|
|
|
|
|
|
|
|
|
|
modified = true; |
|
|
|
modified = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|