diff --git a/Assets/Fungus/Flowchart/Scripts/Block.cs b/Assets/Fungus/Flowchart/Scripts/Block.cs index 245fe83e..a765bb7a 100644 --- a/Assets/Fungus/Flowchart/Scripts/Block.cs +++ b/Assets/Fungus/Flowchart/Scripts/Block.cs @@ -124,9 +124,9 @@ namespace Fungus public virtual int JumpToCommandIndex { set { jumpToCommandIndex = value; } } - public virtual Flowchart GetFlowchart() + public virtual IFlowchart GetFlowchart() { - return GetComponent(); + return GetComponent(); } public virtual bool IsExecuting() @@ -158,7 +158,7 @@ namespace Fungus executionCount++; - Flowchart flowchart = GetFlowchart(); + IFlowchart flowchart = GetFlowchart(); executionState = ExecutionState.Executing; #if UNITY_EDITOR diff --git a/Assets/Fungus/Flowchart/Scripts/Command.cs b/Assets/Fungus/Flowchart/Scripts/Command.cs index 7d60a857..a5089f5b 100644 --- a/Assets/Fungus/Flowchart/Scripts/Command.cs +++ b/Assets/Fungus/Flowchart/Scripts/Command.cs @@ -92,13 +92,13 @@ namespace Fungus /// /// Returns the Flowchart that this command belongs to. /// - public virtual Flowchart GetFlowchart() + public virtual IFlowchart GetFlowchart() { - Flowchart flowchart = GetComponent(); + IFlowchart flowchart = GetComponent(); if (flowchart == null && transform.parent != null) { - flowchart = transform.parent.GetComponent(); + flowchart = transform.parent.GetComponent(); } return flowchart; } @@ -267,7 +267,7 @@ namespace Fungus public virtual string GetFlowchartLocalizationId() { // If no localization id has been set then use the Flowchart name - Flowchart flowchart = GetFlowchart(); + IFlowchart flowchart = GetFlowchart(); if (flowchart == null) { return ""; @@ -276,7 +276,7 @@ namespace Fungus string localizationId = GetFlowchart().LocalizationId; if (localizationId.Length == 0) { - localizationId = flowchart.name; + localizationId = flowchart.GetName(); } return localizationId; diff --git a/Assets/Fungus/Flowchart/Scripts/EventHandler.cs b/Assets/Fungus/Flowchart/Scripts/EventHandler.cs index 4602439c..00cd860d 100644 --- a/Assets/Fungus/Flowchart/Scripts/EventHandler.cs +++ b/Assets/Fungus/Flowchart/Scripts/EventHandler.cs @@ -57,7 +57,7 @@ namespace Fungus return false; } - Flowchart flowchart = parentBlock.GetFlowchart(); + var flowchart = parentBlock.GetFlowchart(); // Auto-follow the executing block if none is currently selected if (flowchart.SelectedBlock == null) diff --git a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs index a3878e98..5cb07404 100644 --- a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs @@ -337,6 +337,11 @@ namespace Fungus return gameObject.activeInHierarchy; } + public string GetName() + { + return gameObject.name; + } + public int NextItemId() { int maxId = -1; diff --git a/Assets/Fungus/Flowchart/Scripts/IBlock.cs b/Assets/Fungus/Flowchart/Scripts/IBlock.cs index ffa44332..a313036d 100644 --- a/Assets/Fungus/Flowchart/Scripts/IBlock.cs +++ b/Assets/Fungus/Flowchart/Scripts/IBlock.cs @@ -67,7 +67,7 @@ namespace Fungus /// /// Returns the parent Flowchart for this Block. /// - Flowchart GetFlowchart(); + IFlowchart GetFlowchart(); /// /// Returns true if the Block is executing a command. diff --git a/Assets/Fungus/Flowchart/Scripts/ICommand.cs b/Assets/Fungus/Flowchart/Scripts/ICommand.cs index 3dd97655..636da53d 100644 --- a/Assets/Fungus/Flowchart/Scripts/ICommand.cs +++ b/Assets/Fungus/Flowchart/Scripts/ICommand.cs @@ -50,7 +50,7 @@ namespace Fungus /// /// Returns the Flowchart that this command belongs to. /// - Flowchart GetFlowchart(); + IFlowchart GetFlowchart(); /// /// Execute the command. diff --git a/Assets/Fungus/Flowchart/Scripts/IFlowchart.cs b/Assets/Fungus/Flowchart/Scripts/IFlowchart.cs index 4638696f..e13e2b5c 100644 --- a/Assets/Fungus/Flowchart/Scripts/IFlowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/IFlowchart.cs @@ -115,9 +115,13 @@ namespace Fungus /// /// Returns true if the Flowchart gameobject is active. /// - /// true if this instance is active; otherwise, false. bool IsActive(); + /// + /// Returns the Flowchart gameobject name. + /// + string GetName(); + /// /// Create a new block node which you can then add commands to. /// diff --git a/Assets/Fungus/Scripts/Commands/Call.cs b/Assets/Fungus/Scripts/Commands/Call.cs index 223eae26..de22fe8e 100644 --- a/Assets/Fungus/Scripts/Commands/Call.cs +++ b/Assets/Fungus/Scripts/Commands/Call.cs @@ -40,7 +40,7 @@ namespace Fungus public override void OnEnter() { - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); if (targetBlock != null) { @@ -63,7 +63,7 @@ namespace Fungus } if (targetFlowchart == null || - targetFlowchart == GetFlowchart()) + targetFlowchart.Equals(GetFlowchart())) { // If the executing block is currently selected then follow the execution // onto the next block in the inspector. diff --git a/Assets/Fungus/Scripts/Commands/Conversation.cs b/Assets/Fungus/Scripts/Commands/Conversation.cs index 49a565a0..f826af87 100644 --- a/Assets/Fungus/Scripts/Commands/Conversation.cs +++ b/Assets/Fungus/Scripts/Commands/Conversation.cs @@ -32,7 +32,7 @@ namespace Fungus protected virtual IEnumerator DoConversation() { - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); string subbedText = flowchart.SubstituteVariables(conversationText.Value); yield return StartCoroutine(conversationManager.DoConversation(subbedText)); diff --git a/Assets/Fungus/Scripts/Commands/DebugLog.cs b/Assets/Fungus/Scripts/Commands/DebugLog.cs index f5b8979d..5d8ca659 100644 --- a/Assets/Fungus/Scripts/Commands/DebugLog.cs +++ b/Assets/Fungus/Scripts/Commands/DebugLog.cs @@ -29,7 +29,7 @@ namespace Fungus public override void OnEnter () { - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); string message = flowchart.SubstituteVariables(logMessage.Value); switch (logType) diff --git a/Assets/Fungus/Scripts/Commands/DeleteSaveKey.cs b/Assets/Fungus/Scripts/Commands/DeleteSaveKey.cs index c7c3c122..7b75eca4 100644 --- a/Assets/Fungus/Scripts/Commands/DeleteSaveKey.cs +++ b/Assets/Fungus/Scripts/Commands/DeleteSaveKey.cs @@ -25,7 +25,7 @@ namespace Fungus return; } - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); // Prepend the current save profile (if any) string prefsKey = SetSaveProfile.saveProfile + "_" + flowchart.SubstituteVariables(key); diff --git a/Assets/Fungus/Scripts/Commands/ExecuteLua.cs b/Assets/Fungus/Scripts/Commands/ExecuteLua.cs index ef0e3e93..359bf425 100644 --- a/Assets/Fungus/Scripts/Commands/ExecuteLua.cs +++ b/Assets/Fungus/Scripts/Commands/ExecuteLua.cs @@ -61,7 +61,7 @@ namespace Fungus // Cache a descriptive name to use in Lua error messages friendlyName = gameObject.name + "." + ParentBlock.BlockName + "." + "ExecuteLua #" + CommandIndex.ToString(); - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); // See if a Lua Environment has been assigned to this Flowchart if (luaEnvironment == null) diff --git a/Assets/Fungus/Scripts/Commands/LoadVariable.cs b/Assets/Fungus/Scripts/Commands/LoadVariable.cs index 05367de0..d5f277ed 100644 --- a/Assets/Fungus/Scripts/Commands/LoadVariable.cs +++ b/Assets/Fungus/Scripts/Commands/LoadVariable.cs @@ -33,7 +33,7 @@ namespace Fungus return; } - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); // Prepend the current save profile (if any) string prefsKey = SetSaveProfile.saveProfile + "_" + flowchart.SubstituteVariables(key); diff --git a/Assets/Fungus/Scripts/Commands/Menu.cs b/Assets/Fungus/Scripts/Commands/Menu.cs index c29167a9..96b0fb58 100644 --- a/Assets/Fungus/Scripts/Commands/Menu.cs +++ b/Assets/Fungus/Scripts/Commands/Menu.cs @@ -52,7 +52,7 @@ namespace Fungus { menuDialog.SetActive(true); - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); string displayText = flowchart.SubstituteVariables(text); menuDialog.AddOption(displayText, interactable, targetBlock); diff --git a/Assets/Fungus/Scripts/Commands/SaveVariable.cs b/Assets/Fungus/Scripts/Commands/SaveVariable.cs index 9aeb505f..f7da07f2 100644 --- a/Assets/Fungus/Scripts/Commands/SaveVariable.cs +++ b/Assets/Fungus/Scripts/Commands/SaveVariable.cs @@ -37,7 +37,7 @@ namespace Fungus return; } - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); // Prepend the current save profile (if any) string prefsKey = SetSaveProfile.saveProfile + "_" + flowchart.SubstituteVariables(key); diff --git a/Assets/Fungus/Scripts/Commands/Say.cs b/Assets/Fungus/Scripts/Commands/Say.cs index 7d594719..def5cfec 100644 --- a/Assets/Fungus/Scripts/Commands/Say.cs +++ b/Assets/Fungus/Scripts/Commands/Say.cs @@ -85,7 +85,7 @@ namespace Fungus return; } - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); sayDialog.SetActive(true); diff --git a/Assets/Fungus/Scripts/Commands/SendMessage.cs b/Assets/Fungus/Scripts/Commands/SendMessage.cs index 7e26c73e..ec5ca954 100644 --- a/Assets/Fungus/Scripts/Commands/SendMessage.cs +++ b/Assets/Fungus/Scripts/Commands/SendMessage.cs @@ -36,12 +36,10 @@ namespace Fungus return; } - Flowchart flowchart = GetFlowchart(); - MessageReceived[] receivers = null; if (messageTarget == MessageTarget.SameFlowchart) { - receivers = flowchart.GetComponents(); + receivers = GetComponents(); } else { diff --git a/Assets/Fungus/Scripts/Commands/SetText.cs b/Assets/Fungus/Scripts/Commands/SetText.cs index 8dde092a..34893fab 100644 --- a/Assets/Fungus/Scripts/Commands/SetText.cs +++ b/Assets/Fungus/Scripts/Commands/SetText.cs @@ -28,7 +28,7 @@ namespace Fungus public override void OnEnter() { - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); string newText = flowchart.SubstituteVariables(text.Value); if (targetTextObject == null) diff --git a/Assets/Fungus/Scripts/Commands/StopBlock.cs b/Assets/Fungus/Scripts/Commands/StopBlock.cs index 3afcefd4..8d40e98e 100644 --- a/Assets/Fungus/Scripts/Commands/StopBlock.cs +++ b/Assets/Fungus/Scripts/Commands/StopBlock.cs @@ -28,7 +28,7 @@ namespace Fungus if (flowchart == null) { - flowchart = GetFlowchart(); + flowchart = (Flowchart)GetFlowchart(); } IBlock block = flowchart.FindBlock(blockName.Value); diff --git a/Assets/Fungus/Scripts/Commands/StopFlowchart.cs b/Assets/Fungus/Scripts/Commands/StopFlowchart.cs index 938d89ba..41c012cc 100644 --- a/Assets/Fungus/Scripts/Commands/StopFlowchart.cs +++ b/Assets/Fungus/Scripts/Commands/StopFlowchart.cs @@ -23,14 +23,14 @@ namespace Fungus public override void OnEnter() { - Flowchart flowchart = GetFlowchart(); + IFlowchart flowchart = GetFlowchart(); if (stopParentFlowchart) { flowchart.StopAllBlocks(); } - foreach (Flowchart f in targetFlowcharts) + foreach (IFlowchart f in targetFlowcharts) { if (f == flowchart) { diff --git a/Assets/Fungus/Scripts/Commands/Write.cs b/Assets/Fungus/Scripts/Commands/Write.cs index c2c5f856..c92fa412 100644 --- a/Assets/Fungus/Scripts/Commands/Write.cs +++ b/Assets/Fungus/Scripts/Commands/Write.cs @@ -82,7 +82,7 @@ namespace Fungus break; } - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); string newText = flowchart.SubstituteVariables(text.Value); if (!waitUntilFinished) diff --git a/Assets/Fungus/Scripts/Components/Localization.cs b/Assets/Fungus/Scripts/Components/Localization.cs index 375e884b..429b20ec 100644 --- a/Assets/Fungus/Scripts/Components/Localization.cs +++ b/Assets/Fungus/Scripts/Components/Localization.cs @@ -135,8 +135,8 @@ namespace Fungus // Add localizable commands in same order as command list to make it // easier to localise / edit standard text. - Flowchart[] flowcharts = GameObject.FindObjectsOfType(); - foreach (Flowchart flowchart in flowcharts) + var flowcharts = GameObject.FindObjectsOfType(); + foreach (var flowchart in flowcharts) { IBlock[] blocks = flowchart.GetComponents(); foreach (IBlock block in blocks) diff --git a/Assets/Fungus/Scripts/Components/MenuDialog.cs b/Assets/Fungus/Scripts/Components/MenuDialog.cs index 2f0a6b52..52a1a16a 100644 --- a/Assets/Fungus/Scripts/Components/MenuDialog.cs +++ b/Assets/Fungus/Scripts/Components/MenuDialog.cs @@ -184,7 +184,7 @@ namespace Fungus { #if UNITY_EDITOR // Select the new target block in the Flowchart window - Flowchart flowchart = block.GetFlowchart(); + var flowchart = block.GetFlowchart(); flowchart.SelectedBlock = block; #endif diff --git a/Assets/Fungus/Scripts/Components/SayDialog.cs b/Assets/Fungus/Scripts/Components/SayDialog.cs index d7ebeb43..3a6775a8 100644 --- a/Assets/Fungus/Scripts/Components/SayDialog.cs +++ b/Assets/Fungus/Scripts/Components/SayDialog.cs @@ -245,7 +245,7 @@ namespace Fungus gameObject.SetActive(state); } - public virtual void SetCharacter(Character character, Flowchart flowchart = null) + public virtual void SetCharacter(Character character, IFlowchart flowchart = null) { if (character == null) { diff --git a/Assets/Fungus/Scripts/Editor/BlockEditor.cs b/Assets/Fungus/Scripts/Editor/BlockEditor.cs index 310f7d4e..2bae7892 100644 --- a/Assets/Fungus/Scripts/Editor/BlockEditor.cs +++ b/Assets/Fungus/Scripts/Editor/BlockEditor.cs @@ -633,7 +633,7 @@ namespace Fungus { IBlock block = target as IBlock; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); // Use index of last selected command in list, or end of list if nothing selected. int index = -1; @@ -728,7 +728,7 @@ namespace Fungus return; } - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); flowchart.ClearSelectedCommands(); @@ -757,7 +757,7 @@ namespace Fungus public virtual void ShowContextMenu() { IBlock block = target as IBlock; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); if (flowchart == null) { @@ -845,7 +845,7 @@ namespace Fungus protected void SelectAll() { IBlock block = target as IBlock; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); if (flowchart == null || flowchart.SelectedBlock == null) @@ -866,7 +866,7 @@ namespace Fungus protected void SelectNone() { IBlock block = target as IBlock; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); if (flowchart == null || flowchart.SelectedBlock == null) @@ -889,7 +889,7 @@ namespace Fungus protected void Copy() { IBlock block = target as IBlock; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); if (flowchart == null || flowchart.SelectedBlock == null) @@ -919,7 +919,7 @@ namespace Fungus protected void Paste() { IBlock block = target as IBlock; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); if (flowchart == null || flowchart.SelectedBlock == null) @@ -978,7 +978,7 @@ namespace Fungus protected void Delete() { IBlock block = target as IBlock; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); if (flowchart == null || flowchart.SelectedBlock == null) @@ -1023,7 +1023,7 @@ namespace Fungus protected void PlayCommand() { IBlock targetBlock = target as IBlock; - Flowchart flowchart = targetBlock.GetFlowchart(); + var flowchart = (Flowchart)targetBlock.GetFlowchart(); Command command = flowchart.SelectedCommands[0]; if (targetBlock.IsExecuting()) { @@ -1043,7 +1043,7 @@ namespace Fungus protected void StopAllPlayCommand() { IBlock targetBlock = target as IBlock; - Flowchart flowchart = targetBlock.GetFlowchart(); + var flowchart = (Flowchart)targetBlock.GetFlowchart(); Command command = flowchart.SelectedCommands[0]; // Stop all active blocks then run the selected block. @@ -1060,7 +1060,7 @@ namespace Fungus protected void SelectPrevious() { IBlock block = target as IBlock; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); int firstSelectedIndex = flowchart.SelectedBlock.CommandList.Count; bool firstSelectedCommandFound = false; @@ -1100,7 +1100,7 @@ namespace Fungus protected void SelectNext() { IBlock block = target as IBlock; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); int lastSelectedIndex = -1; if (flowchart.SelectedCommands.Count > 0) diff --git a/Assets/Fungus/Scripts/Editor/BlockInspector.cs b/Assets/Fungus/Scripts/Editor/BlockInspector.cs index f7221973..f7accb2f 100644 --- a/Assets/Fungus/Scripts/Editor/BlockInspector.cs +++ b/Assets/Fungus/Scripts/Editor/BlockInspector.cs @@ -77,7 +77,7 @@ namespace Fungus IBlock block = blockInspector.block; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); if (activeBlockEditor == null || !block.Equals(activeBlockEditor.target)) diff --git a/Assets/Fungus/Scripts/Editor/CallEditor.cs b/Assets/Fungus/Scripts/Editor/CallEditor.cs index 8be7baac..96e4500b 100644 --- a/Assets/Fungus/Scripts/Editor/CallEditor.cs +++ b/Assets/Fungus/Scripts/Editor/CallEditor.cs @@ -34,7 +34,7 @@ namespace Fungus Flowchart flowchart = null; if (targetFlowchartProp.objectReferenceValue == null) { - flowchart = t.GetFlowchart(); + flowchart = (Flowchart)t.GetFlowchart(); } else { diff --git a/Assets/Fungus/Scripts/Editor/CommandEditor.cs b/Assets/Fungus/Scripts/Editor/CommandEditor.cs index d5f6d64c..93e1137f 100644 --- a/Assets/Fungus/Scripts/Editor/CommandEditor.cs +++ b/Assets/Fungus/Scripts/Editor/CommandEditor.cs @@ -37,7 +37,7 @@ namespace Fungus return; } - Flowchart flowchart = t.GetFlowchart(); + var flowchart = (Flowchart)t.GetFlowchart(); if (flowchart == null) { return; diff --git a/Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs b/Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs index 0dd64147..37ff844e 100644 --- a/Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs +++ b/Assets/Fungus/Scripts/Editor/CommandListAdaptor.cs @@ -167,7 +167,7 @@ namespace Fungus return; } - Flowchart flowchart = command.GetFlowchart(); + var flowchart = (Flowchart)command.GetFlowchart(); if (flowchart == null) { return; diff --git a/Assets/Fungus/Scripts/Editor/FlowchartEditor.cs b/Assets/Fungus/Scripts/Editor/FlowchartEditor.cs index 8edf66d0..00ef1225 100644 --- a/Assets/Fungus/Scripts/Editor/FlowchartEditor.cs +++ b/Assets/Fungus/Scripts/Editor/FlowchartEditor.cs @@ -57,7 +57,7 @@ namespace Fungus { serializedObject.Update(); - Flowchart flowchart = target as Flowchart; + var flowchart = target as Flowchart; flowchart.UpdateHideFlags(); @@ -100,7 +100,7 @@ namespace Fungus { serializedObject.Update(); - Flowchart t = target as Flowchart; + var t = target as Flowchart; if (t.Variables.Count == 0) { @@ -240,7 +240,7 @@ namespace Fungus return; } - Flowchart flowchart = addVariableInfo.flowchart; + var flowchart = addVariableInfo.flowchart; System.Type variableType = addVariableInfo.variableType; Undo.RecordObject(flowchart, "Add Variable"); diff --git a/Assets/Fungus/Scripts/Editor/FlowchartMenuItems.cs b/Assets/Fungus/Scripts/Editor/FlowchartMenuItems.cs index 168c5c71..3ddaf290 100644 --- a/Assets/Fungus/Scripts/Editor/FlowchartMenuItems.cs +++ b/Assets/Fungus/Scripts/Editor/FlowchartMenuItems.cs @@ -15,7 +15,7 @@ namespace Fungus go.transform.position = Vector3.zero; // This is the latest version of Flowchart, so no need to update. - Flowchart flowchart = go.GetComponent(); + var flowchart = go.GetComponent(); if (flowchart != null) { flowchart.Version = Flowchart.CURRENT_VERSION; diff --git a/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs b/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs index c3311feb..00adf021 100644 --- a/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs +++ b/Assets/Fungus/Scripts/Editor/FlowchartWindow.cs @@ -61,7 +61,7 @@ namespace Fungus protected virtual void OnInspectorUpdate() { // Ensure the Block Inspector is always showing the currently selected block - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); if (flowchart == null) { return; @@ -97,7 +97,7 @@ namespace Fungus if (Selection.activeGameObject != null) { - Flowchart fs = Selection.activeGameObject.GetComponent(); + var fs = Selection.activeGameObject.GetComponent(); if (fs != null) { fungusState.SelectedFlowchart = fs; @@ -109,7 +109,7 @@ namespace Fungus protected virtual void OnGUI() { - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); if (flowchart == null) { GUILayout.Label("No Flowchart scene object selected"); @@ -573,7 +573,7 @@ namespace Fungus protected virtual void DrawWindow(int windowId) { IBlock block = windowBlockMap[windowId]; - Flowchart flowchart = block.GetFlowchart(); + var flowchart = (Flowchart)block.GetFlowchart(); if (flowchart == null) { @@ -713,7 +713,7 @@ namespace Fungus { if (blockB == null || block == blockB || - blockB.GetFlowchart() != flowchart) + !blockB.GetFlowchart().Equals(flowchart)) { continue; } @@ -788,7 +788,7 @@ namespace Fungus protected static void DuplicateBlock(object obj) { - Flowchart flowchart = GetFlowchart(); + var flowchart = GetFlowchart(); Block block = obj as Block; Vector2 newPosition = new Vector2(block._NodeRect.position.x + diff --git a/Assets/Fungus/Scripts/Editor/IfEditor.cs b/Assets/Fungus/Scripts/Editor/IfEditor.cs index 9bcffefc..856e154d 100644 --- a/Assets/Fungus/Scripts/Editor/IfEditor.cs +++ b/Assets/Fungus/Scripts/Editor/IfEditor.cs @@ -36,7 +36,7 @@ namespace Fungus If t = target as If; - Flowchart flowchart = t.GetFlowchart(); + var flowchart = (Flowchart)t.GetFlowchart(); if (flowchart == null) { return; diff --git a/Assets/Fungus/Scripts/Editor/LabelEditor.cs b/Assets/Fungus/Scripts/Editor/LabelEditor.cs index 2ecedcfa..f330f4fb 100644 --- a/Assets/Fungus/Scripts/Editor/LabelEditor.cs +++ b/Assets/Fungus/Scripts/Editor/LabelEditor.cs @@ -62,7 +62,7 @@ namespace Fungus { Label t = target as Label; - Flowchart flowchart = t.GetFlowchart(); + var flowchart = (Flowchart)t.GetFlowchart(); if (flowchart == null) { return; diff --git a/Assets/Fungus/Scripts/Editor/MenuEditor.cs b/Assets/Fungus/Scripts/Editor/MenuEditor.cs index 60f9a001..53b3eff7 100644 --- a/Assets/Fungus/Scripts/Editor/MenuEditor.cs +++ b/Assets/Fungus/Scripts/Editor/MenuEditor.cs @@ -31,7 +31,7 @@ namespace Fungus public override void DrawCommandGUI() { - Flowchart flowchart = FlowchartWindow.GetFlowchart(); + var flowchart = FlowchartWindow.GetFlowchart(); if (flowchart == null) { return; diff --git a/Assets/Fungus/Scripts/Editor/MenuTimerEditor.cs b/Assets/Fungus/Scripts/Editor/MenuTimerEditor.cs index 37e0bcee..6766418d 100644 --- a/Assets/Fungus/Scripts/Editor/MenuTimerEditor.cs +++ b/Assets/Fungus/Scripts/Editor/MenuTimerEditor.cs @@ -23,7 +23,7 @@ namespace Fungus public override void DrawCommandGUI() { - Flowchart flowchart = FlowchartWindow.GetFlowchart(); + var flowchart = FlowchartWindow.GetFlowchart(); if (flowchart == null) { return; diff --git a/Assets/Fungus/Scripts/Editor/SetVariableEditor.cs b/Assets/Fungus/Scripts/Editor/SetVariableEditor.cs index ad761a86..2efba94b 100644 --- a/Assets/Fungus/Scripts/Editor/SetVariableEditor.cs +++ b/Assets/Fungus/Scripts/Editor/SetVariableEditor.cs @@ -37,7 +37,7 @@ namespace Fungus SetVariable t = target as SetVariable; - Flowchart flowchart = t.GetFlowchart(); + var flowchart = (Flowchart)t.GetFlowchart(); if (flowchart == null) { return; diff --git a/Assets/Fungus/Scripts/Editor/VariableEditor.cs b/Assets/Fungus/Scripts/Editor/VariableEditor.cs index 73ad21b3..7a30aac8 100644 --- a/Assets/Fungus/Scripts/Editor/VariableEditor.cs +++ b/Assets/Fungus/Scripts/Editor/VariableEditor.cs @@ -203,7 +203,7 @@ namespace Fungus return; } - Flowchart flowchart = command.GetFlowchart() as Flowchart; + var flowchart = command.GetFlowchart() as Flowchart; if (flowchart == null) { return; diff --git a/Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs b/Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs index e3f7e290..e1fe8319 100644 --- a/Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs +++ b/Assets/Fungus/Scripts/Editor/VariableListAdaptor.cs @@ -123,7 +123,7 @@ namespace Fungus return; } - Flowchart flowchart = FlowchartWindow.GetFlowchart(); + var flowchart = FlowchartWindow.GetFlowchart(); if (flowchart == null) { return; diff --git a/Assets/Fungus/Scripts/Editor/ViewEditor.cs b/Assets/Fungus/Scripts/Editor/ViewEditor.cs index 9ebcbadd..f1e7d724 100644 --- a/Assets/Fungus/Scripts/Editor/ViewEditor.cs +++ b/Assets/Fungus/Scripts/Editor/ViewEditor.cs @@ -168,7 +168,7 @@ namespace Fungus bool highlight = Selection.activeGameObject == view.gameObject; - Flowchart flowchart = FlowchartWindow.GetFlowchart(); + var flowchart = FlowchartWindow.GetFlowchart(); if (flowchart != null) { foreach (Command command in flowchart.SelectedCommands) diff --git a/Assets/Fungus/Scripts/Interfaces/ISayDialog.cs b/Assets/Fungus/Scripts/Interfaces/ISayDialog.cs index 319ef96e..51ac8808 100644 --- a/Assets/Fungus/Scripts/Interfaces/ISayDialog.cs +++ b/Assets/Fungus/Scripts/Interfaces/ISayDialog.cs @@ -18,7 +18,7 @@ namespace Fungus /// /// The active speaking character. /// An optional Flowchart to use for variable substitution in the character name string. - void SetCharacter(Character character, Flowchart flowchart = null); + void SetCharacter(Character character, IFlowchart flowchart = null); /// /// Sets the character image to display on the Say Dialog.