From 3af0a9faa268c8237b629002ac823e950e378634 Mon Sep 17 00:00:00 2001 From: Timothy Ng Date: Thu, 24 Mar 2016 21:15:26 -0400 Subject: [PATCH 1/8] Command List now displays line numbers --- Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs | 4 ++-- Assets/Tests/TestAssets/Animation.meta | 9 --------- ProjectSettings/ProjectVersion.txt | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 Assets/Tests/TestAssets/Animation.meta diff --git a/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs b/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs index 39217fe6..79f3a57d 100644 --- a/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs +++ b/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs @@ -389,11 +389,11 @@ namespace Fungus if (isComment) { - GUI.Label(commandLabelRect, "", commandLabelStyle); + GUI.Label(commandLabelRect, command.commandIndex + ": ", commandLabelStyle); } else { - GUI.Label(commandLabelRect, commandName, commandLabelStyle); + GUI.Label(commandLabelRect, command.commandIndex + ": " + commandName, commandLabelStyle); } if (command.executingIconTimer > Time.realtimeSinceStartup) diff --git a/Assets/Tests/TestAssets/Animation.meta b/Assets/Tests/TestAssets/Animation.meta deleted file mode 100644 index 3fd2cc3b..00000000 --- a/Assets/Tests/TestAssets/Animation.meta +++ /dev/null @@ -1,9 +0,0 @@ -fileFormatVersion: 2 -guid: f5528a125b1c64ce4b4ad7ae57de4989 -folderAsset: yes -timeCreated: 1458814143 -licenseType: Free -DefaultImporter: - userData: - assetBundleName: - assetBundleVariant: diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index c4684cd5..bb60c067 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 5.3.4f1 +m_EditorVersion: 5.3.2f1 m_StandardAssetsVersion: 0 From 54edaf14fe5fde98ace9245108c49364bf95c98e Mon Sep 17 00:00:00 2001 From: Timothy Ng Date: Thu, 24 Mar 2016 22:54:55 -0400 Subject: [PATCH 2/8] Fixed formating of command list --- Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs | 4 ++-- Assets/Fungus/Flowchart/Editor/EditorZoomArea.cs | 8 +++++--- Assets/Fungus/Flowchart/Editor/FlowchartWindow.cs | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs b/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs index 79f3a57d..a1340d02 100644 --- a/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs +++ b/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs @@ -421,8 +421,8 @@ namespace Fungus } else { - summaryRect.x += commandNameWidth; - summaryRect.width -= commandNameWidth; + summaryRect.x += commandNameWidth + 20; + summaryRect.width -= commandNameWidth + 20; summaryRect.width -= 5; } diff --git a/Assets/Fungus/Flowchart/Editor/EditorZoomArea.cs b/Assets/Fungus/Flowchart/Editor/EditorZoomArea.cs index 5f7d0aa1..c5b9ac58 100644 --- a/Assets/Fungus/Flowchart/Editor/EditorZoomArea.cs +++ b/Assets/Fungus/Flowchart/Editor/EditorZoomArea.cs @@ -66,11 +66,13 @@ namespace Fungus GUI.BeginGroup(clippedArea); _prevGuiMatrix = GUI.matrix; - Matrix4x4 translation = Matrix4x4.TRS(clippedArea.TopLeft(), Quaternion.identity, Vector3.one); + + Matrix4x4 translation = Matrix4x4.TRS(clippedArea.TopLeft(), Quaternion.identity, Vector3.one); Matrix4x4 scale = Matrix4x4.Scale(new Vector3(zoomScale, zoomScale, 1.0f)); GUI.matrix = translation * scale * translation.inverse * GUI.matrix; - - return clippedArea; + + + return clippedArea; } public static void End() diff --git a/Assets/Fungus/Flowchart/Editor/FlowchartWindow.cs b/Assets/Fungus/Flowchart/Editor/FlowchartWindow.cs index 2f5fd60e..3063420d 100755 --- a/Assets/Fungus/Flowchart/Editor/FlowchartWindow.cs +++ b/Assets/Fungus/Flowchart/Editor/FlowchartWindow.cs @@ -559,8 +559,8 @@ namespace Fungus return; } - // Select block when node is clicked - if (Event.current.button == 0 && + // Select block when node is clicked + if (Event.current.button == 0 && Event.current.type == EventType.MouseDown && !mouseOverVariables) { From dc069367ed6a5d9ff3411acd6b7197af4b2a8cae Mon Sep 17 00:00:00 2001 From: Timothy Ng Date: Thu, 24 Mar 2016 23:44:33 -0400 Subject: [PATCH 3/8] Refactored Flowchart.cs to use the more general GetVariable method --- .../Scripts/Commands/InvokeMethod.cs | 44 +++-- Assets/Fungus/Flowchart/Scripts/Flowchart.cs | 171 +----------------- Assets/Tests/Scripting/TestInvoke.cs | 8 +- 3 files changed, 32 insertions(+), 191 deletions(-) diff --git a/Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs b/Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs index e414bd38..65b95ff7 100755 --- a/Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs +++ b/Assets/Fungus/Flowchart/Scripts/Commands/InvokeMethod.cs @@ -191,18 +191,26 @@ namespace Fungus switch (item.objValue.typeFullname) { case "System.Int32": - objValue = flowChart.GetIntegerVariable(item.variableKey); - break; - case "System.Boolean": - objValue = flowChart.GetBooleanVariable(item.variableKey); - break; + var intvalue = flowChart.GetVariable(item.variableKey); + if (intvalue != null) + objValue = intvalue.value; + break; + case "System.Boolean": + var boolean = flowChart.GetVariable(item.variableKey); + if (boolean != null) + objValue = boolean.value; + break; case "System.Single": - objValue = flowChart.GetFloatVariable(item.variableKey); - break; - case "System.String": - objValue = flowChart.GetStringVariable(item.variableKey); - break; - case "UnityEngine.Color": + var floatvalue = flowChart.GetVariable(item.variableKey); + if (floatvalue != null) + objValue = floatvalue.value; + break; + case "System.String": + var stringvalue = flowChart.GetVariable(item.variableKey); + if (stringvalue != null) + objValue = stringvalue.value; + break; + case "UnityEngine.Color": var color = flowChart.GetVariable(item.variableKey); if (color != null) objValue = color.value; @@ -258,17 +266,17 @@ namespace Fungus switch (returnType) { case "System.Int32": - flowChart.SetIntegerVariable(key, (int)value); - break; + flowChart.GetVariable(key).value = (int)value; + break; case "System.Boolean": - flowChart.SetBooleanVariable(key, (bool)value); + flowChart.GetVariable(key).value = (bool)value; break; case "System.Single": - flowChart.SetFloatVariable(key, (float)value); - break; + flowChart.GetVariable(key).value = (float)value; + break; case "System.String": - flowChart.SetStringVariable(key, (string)value); - break; + flowChart.GetVariable(key).value = (string)value; + break; case "UnityEngine.Color": flowChart.GetVariable(key).value = (UnityEngine.Color)value; break; diff --git a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs index c7e0893a..dc9abbef 100644 --- a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs @@ -606,7 +606,8 @@ namespace Fungus } } - return null; + Debug.LogWarning("Variable " + key + " not found."); + return null; } /** @@ -626,174 +627,6 @@ namespace Fungus return publicVariables; } - /** - * Gets the value of a boolean variable. - * Returns false if the variable key does not exist. - */ - public virtual bool GetBooleanVariable(string key) - { - foreach (Variable v in variables) - { - if (v != null && v.key == key) - { - BooleanVariable variable = v as BooleanVariable; - if (variable != null) - { - return variable.value; - } - } - } - Debug.LogWarning("Boolean variable " + key + " not found."); - return false; - } - - /** - * Sets the value of a boolean variable. - * The variable must already be added to the list of variables for this Flowchart. - */ - public virtual void SetBooleanVariable(string key, bool value) - { - foreach (Variable v in variables) - { - if (v != null && v.key == key) - { - BooleanVariable variable = v as BooleanVariable; - if (variable != null) - { - variable.value = value; - return; - } - } - } - Debug.LogWarning("Boolean variable " + key + " not found."); - } - - /** - * Gets the value of an integer variable. - * Returns 0 if the variable key does not exist. - */ - public virtual int GetIntegerVariable(string key) - { - foreach (Variable v in variables) - { - if (v != null && v.key == key) - { - IntegerVariable variable = v as IntegerVariable; - if (variable != null) - { - return variable.value; - } - } - } - Debug.LogWarning("Integer variable " + key + " not found."); - return 0; - } - - /** - * Sets the value of an integer variable. - * The variable must already be added to the list of variables for this Flowchart. - */ - public virtual void SetIntegerVariable(string key, int value) - { - foreach (Variable v in variables) - { - if (v != null && v.key == key) - { - IntegerVariable variable = v as IntegerVariable; - if (variable != null) - { - variable.value = value; - return; - } - } - } - Debug.LogWarning("Integer variable " + key + " not found."); - } - - /** - * Gets the value of a float variable. - * Returns 0 if the variable key does not exist. - */ - public virtual float GetFloatVariable(string key) - { - foreach (Variable v in variables) - { - if (v != null && v.key == key) - { - FloatVariable variable = v as FloatVariable; - if (variable != null) - { - return variable.value; - } - } - } - Debug.LogWarning("Float variable " + key + " not found."); - return 0f; - } - - /** - * Sets the value of a float variable. - * The variable must already be added to the list of variables for this Flowchart. - */ - public virtual void SetFloatVariable(string key, float value) - { - foreach (Variable v in variables) - { - if (v != null && v.key == key) - { - FloatVariable variable = v as FloatVariable; - if (variable != null) - { - variable.value = value; - return; - } - } - } - Debug.LogWarning("Float variable " + key + " not found."); - } - - /** - * Gets the value of a string variable. - * Returns the empty string if the variable key does not exist. - */ - public virtual string GetStringVariable(string key) - { - foreach (Variable v in variables) - { - if (v != null && v.key == key) - { - StringVariable variable = v as StringVariable; - if (variable != null) - { - return variable.value; - } - } - } - Debug.LogWarning("String variable " + key + " not found."); - return ""; - } - - /** - * Sets the value of a string variable. - * The variable must already be added to the list of variables for this Flowchart. - */ - public virtual void SetStringVariable(string key, string value) - { - foreach (Variable v in variables) - { - if (v != null && v.key == key) - { - StringVariable variable = v as StringVariable; - if (variable != null) - { - variable.value = value; - return; - } - } - } - Debug.LogWarning("String variable " + key + " not found."); - } - /** * Set the block objects to be hidden or visible depending on the hideComponents property. */ diff --git a/Assets/Tests/Scripting/TestInvoke.cs b/Assets/Tests/Scripting/TestInvoke.cs index f5a188ca..0c680587 100644 --- a/Assets/Tests/Scripting/TestInvoke.cs +++ b/Assets/Tests/Scripting/TestInvoke.cs @@ -95,10 +95,10 @@ namespace Fungus } // Check Fungus variables are populated with expected values - if (flowchart.GetBooleanVariable("BoolVar") != true || - flowchart.GetIntegerVariable("IntVar") != 5 || - flowchart.GetFloatVariable("FloatVar") != 22.1f || - flowchart.GetStringVariable("StringVar") != "a string") + if (flowchart.GetVariable("BoolVar").value != true || + flowchart.GetVariable("IntVar").value != 5 || + flowchart.GetVariable("FloatVar").value != 22.1f || + flowchart.GetVariable("StringVar").value != "a string") { IntegrationTest.Fail("Fungus variables do not match expected values"); return; From 74c14f5985a3ed16c1178f93d951dbfbed12af76 Mon Sep 17 00:00:00 2001 From: Timothy Ng Date: Fri, 25 Mar 2016 11:06:55 -0400 Subject: [PATCH 4/8] replaced say dropdown menu with object picker --- Assets/Fungus/Flowchart/Editor/CommandEditor.cs | 6 +++++- Assets/Fungus/Narrative/Editor/SayEditor.cs | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Assets/Fungus/Flowchart/Editor/CommandEditor.cs b/Assets/Fungus/Flowchart/Editor/CommandEditor.cs index e579954e..f48ddb2c 100644 --- a/Assets/Fungus/Flowchart/Editor/CommandEditor.cs +++ b/Assets/Fungus/Flowchart/Editor/CommandEditor.cs @@ -154,6 +154,7 @@ namespace Fungus serializedObject.ApplyModifiedProperties(); } + static public void ObjectField(SerializedProperty property, GUIContent label, GUIContent nullLabel, List objectList) where T : Object { if (property == null) @@ -172,14 +173,16 @@ namespace Fungus if (objectList[i] == null) continue; objectNames.Add(new GUIContent(objectList[i].name)); + if (selectedObject == objectList[i]) { selectedIndex = i + 1; } + } T result; - + selectedIndex = EditorGUILayout.Popup(label, selectedIndex, objectNames.ToArray()); if (selectedIndex == 0) { @@ -192,6 +195,7 @@ namespace Fungus property.objectReferenceValue = result; } + /** * When modifying custom editor code you can occasionally end up with orphaned editor instances. diff --git a/Assets/Fungus/Narrative/Editor/SayEditor.cs b/Assets/Fungus/Narrative/Editor/SayEditor.cs index 11a9ecb8..ac128408 100644 --- a/Assets/Fungus/Narrative/Editor/SayEditor.cs +++ b/Assets/Fungus/Narrative/Editor/SayEditor.cs @@ -111,17 +111,14 @@ namespace Fungus { DestroyImmediate(blackTex); } - + public override void DrawCommandGUI() { serializedObject.Update(); bool showPortraits = false; - CommandEditor.ObjectField(characterProp, - new GUIContent("Character", "Character that is speaking"), - new GUIContent(""), - Character.activeCharacters); + characterProp.objectReferenceValue = (Character) EditorGUILayout.ObjectField(characterProp.objectReferenceValue, typeof(Character), true); Say t = target as Say; From 1ac8669a43c106c22716be754f4d865bd526e254 Mon Sep 17 00:00:00 2001 From: Timothy Ng Date: Fri, 25 Mar 2016 16:38:36 -0400 Subject: [PATCH 5/8] Implemented suggestions --- .../Flowchart/Editor/CommandListAdaptor.cs | 6 +- Assets/Fungus/Flowchart/Scripts/Flowchart.cs | 149 +++++++++++++++++- Assets/Fungus/Narrative/Editor/SayEditor.cs | 5 +- 3 files changed, 152 insertions(+), 8 deletions(-) diff --git a/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs b/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs index a1340d02..7aa96b8b 100644 --- a/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs +++ b/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs @@ -389,11 +389,11 @@ namespace Fungus if (isComment) { - GUI.Label(commandLabelRect, command.commandIndex + ": ", commandLabelStyle); + GUI.Label(commandLabelRect, "", commandLabelStyle); } else { - GUI.Label(commandLabelRect, command.commandIndex + ": " + commandName, commandLabelStyle); + GUI.Label(commandLabelRect, commandName, commandLabelStyle); } if (command.executingIconTimer > Time.realtimeSinceStartup) @@ -433,7 +433,7 @@ namespace Fungus summaryStyle.wordWrap = false; summaryStyle.clipping = TextClipping.Clip; commandLabelStyle.alignment = TextAnchor.MiddleLeft; - GUI.Label(summaryRect, summary, summaryStyle); + GUI.Label(summaryRect, command.commandIndex + ": " + summary, summaryStyle); if (error) { diff --git a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs index 15c87030..697cabc4 100644 --- a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs @@ -645,10 +645,27 @@ namespace Fungus return null; } - /** + public void SetVariable(string key, T newvariable) where T : Variable + { + foreach (Variable v in variables) + { + if (v != null && v.key == key) + { + T variable = v as T; + if (variable != null) + { + variable = newvariable; + return; + } + } + } + Debug.LogWarning("Variable " + key + " not found."); + } + + /** * Gets a list of all variables with public scope in this Flowchart. */ - public virtual List GetPublicVariables() + public virtual List GetPublicVariables() { List publicVariables = new List(); foreach (Variable v in variables) @@ -662,10 +679,134 @@ namespace Fungus return publicVariables; } - /** + /** + * Gets the value of a boolean variable. + * Returns false if the variable key does not exist. + */ + public virtual bool GetBooleanVariable(string key) + { + BooleanVariable variable = GetVariable(key); + + if(variable != null) + { + return GetVariable(key).value; + } + else + { + return false; + } + } + + /** + * Sets the value of a boolean variable. + * The variable must already be added to the list of variables for this Flowchart. + */ + public virtual void SetBooleanVariable(string key, bool value) + { + BooleanVariable variable = GetVariable(key); + if(variable != null) + { + variable.value = value; + } + } + + /** + * Gets the value of an integer variable. + * Returns 0 if the variable key does not exist. + */ + public virtual int GetIntegerVariable(string key) + { + IntegerVariable variable = GetVariable(key); + + if (variable != null) + { + return GetVariable(key).value; + } + else + { + return 0; + } + } + + /** + * Sets the value of an integer variable. + * The variable must already be added to the list of variables for this Flowchart. + */ + public virtual void SetIntegerVariable(string key, int value) + { + IntegerVariable variable = GetVariable(key); + if (variable != null) + { + variable.value = value; + } + } + + /** + * Gets the value of a float variable. + * Returns 0 if the variable key does not exist. + */ + public virtual float GetFloatVariable(string key) + { + FloatVariable variable = GetVariable(key); + + if (variable != null) + { + return GetVariable(key).value; + } + else + { + return 0f; + } + } + + /** + * Sets the value of a float variable. + * The variable must already be added to the list of variables for this Flowchart. + */ + public virtual void SetFloatVariable(string key, float value) + { + FloatVariable variable = GetVariable(key); + if (variable != null) + { + variable.value = value; + } + } + + /** + * Gets the value of a string variable. + * Returns the empty string if the variable key does not exist. + */ + public virtual string GetStringVariable(string key) + { + StringVariable variable = GetVariable(key); + + if (variable != null) + { + return GetVariable(key).value; + } + else + { + return ""; + } + } + + /** + * Sets the value of a string variable. + * The variable must already be added to the list of variables for this Flowchart. + */ + public virtual void SetStringVariable(string key, string value) + { + StringVariable variable = GetVariable(key); + if (variable != null) + { + variable.value = value; + } + } + + /** * Set the block objects to be hidden or visible depending on the hideComponents property. */ - public virtual void UpdateHideFlags() + public virtual void UpdateHideFlags() { if (hideComponents) { diff --git a/Assets/Fungus/Narrative/Editor/SayEditor.cs b/Assets/Fungus/Narrative/Editor/SayEditor.cs index ac128408..75580ac3 100644 --- a/Assets/Fungus/Narrative/Editor/SayEditor.cs +++ b/Assets/Fungus/Narrative/Editor/SayEditor.cs @@ -117,7 +117,10 @@ namespace Fungus serializedObject.Update(); bool showPortraits = false; - + CommandEditor.ObjectField(characterProp, + new GUIContent("Character", "Character that is speaking"), + new GUIContent(""), + Character.activeCharacters); characterProp.objectReferenceValue = (Character) EditorGUILayout.ObjectField(characterProp.objectReferenceValue, typeof(Character), true); Say t = target as Say; From 62a1b8d40b188cbc45a5d7a529f14c95232698dd Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Tue, 29 Mar 2016 16:05:15 +0100 Subject: [PATCH 6/8] Added Show Line Numbers option to Flowchart --- .../Fungus/Flowchart/Editor/CommandListAdaptor.cs | 14 ++++++++++++-- Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs | 3 +++ Assets/Fungus/Flowchart/Scripts/Flowchart.cs | 6 ++++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs b/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs index 7aa96b8b..e6d5c83f 100644 --- a/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs +++ b/Assets/Fungus/Flowchart/Editor/CommandListAdaptor.cs @@ -393,7 +393,17 @@ namespace Fungus } else { - GUI.Label(commandLabelRect, commandName, commandLabelStyle); + string commandNameLabel; + if (flowchart.showLineNumbers) + { + commandNameLabel = command.commandIndex.ToString() + ": " + commandName; + } + else + { + commandNameLabel = commandName; + } + + GUI.Label(commandLabelRect, commandNameLabel, commandLabelStyle); } if (command.executingIconTimer > Time.realtimeSinceStartup) @@ -433,7 +443,7 @@ namespace Fungus summaryStyle.wordWrap = false; summaryStyle.clipping = TextClipping.Clip; commandLabelStyle.alignment = TextAnchor.MiddleLeft; - GUI.Label(summaryRect, command.commandIndex + ": " + summary, summaryStyle); + GUI.Label(summaryRect, summary, summaryStyle); if (error) { diff --git a/Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs b/Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs index 24a4eced..f7aee951 100644 --- a/Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs +++ b/Assets/Fungus/Flowchart/Editor/FlowchartEditor.cs @@ -25,6 +25,7 @@ namespace Fungus protected SerializedProperty saveSelectionProp; protected SerializedProperty localizationIdProp; protected SerializedProperty variablesProp; + protected SerializedProperty showLineNumbersProp; protected SerializedProperty hideCommandsProp; protected Texture2D addTexture; @@ -41,6 +42,7 @@ namespace Fungus saveSelectionProp = serializedObject.FindProperty("saveSelection"); localizationIdProp = serializedObject.FindProperty("localizationId"); variablesProp = serializedObject.FindProperty("variables"); + showLineNumbersProp = serializedObject.FindProperty("showLineNumbers"); hideCommandsProp = serializedObject.FindProperty("hideCommands"); addTexture = Resources.Load("Icons/add_small") as Texture2D; @@ -60,6 +62,7 @@ namespace Fungus EditorGUILayout.PropertyField(stepPauseProp); EditorGUILayout.PropertyField(saveSelectionProp); EditorGUILayout.PropertyField(localizationIdProp); + EditorGUILayout.PropertyField(showLineNumbersProp); // Show list of commands to hide in Add Command menu ReorderableListGUI.Title(new GUIContent(hideCommandsProp.displayName, hideCommandsProp.tooltip)); diff --git a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs index 697cabc4..f47ca04e 100644 --- a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs @@ -134,6 +134,12 @@ namespace Fungus [Tooltip("Unique identifier for this flowchart in localized string keys. If no id is specified then the name of the Flowchart object will be used.")] public string localizationId = ""; + /** + * Display line numbers in the command list in the Block inspector. + */ + [Tooltip("Display line numbers in the command list in the Block inspector.")] + public bool showLineNumbers = false; + /** * List of commands to hide in the Add Command menu. Use this to restrict the set of commands available when editing a Flowchart. */ From c0d1575f3336abf73618b640fd6792e2b977cc76 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Tue, 29 Mar 2016 16:18:17 +0100 Subject: [PATCH 7/8] Added comment for new SetVariable method. --- Assets/Fungus/Flowchart/Scripts/Flowchart.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs index f47ca04e..00b9b64a 100644 --- a/Assets/Fungus/Flowchart/Scripts/Flowchart.cs +++ b/Assets/Fungus/Flowchart/Scripts/Flowchart.cs @@ -651,6 +651,10 @@ namespace Fungus return null; } + /** + * Register a new variable with the Flowchart at runtime. + * The variable should be added as a component on the Flowchart game object. + */ public void SetVariable(string key, T newvariable) where T : Variable { foreach (Variable v in variables) @@ -665,6 +669,7 @@ namespace Fungus } } } + Debug.LogWarning("Variable " + key + " not found."); } From 0797b54d326de7e279fb3c86a33d1ca3a74d6c5d Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Tue, 29 Mar 2016 16:19:47 +0100 Subject: [PATCH 8/8] Indented character object field on Say command Note: This new property is useful if you want to define your characters as prefabs and just link to the prefab instead of an instance in the scene. --- Assets/Fungus/Narrative/Editor/SayEditor.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Assets/Fungus/Narrative/Editor/SayEditor.cs b/Assets/Fungus/Narrative/Editor/SayEditor.cs index 75580ac3..c0d5c764 100644 --- a/Assets/Fungus/Narrative/Editor/SayEditor.cs +++ b/Assets/Fungus/Narrative/Editor/SayEditor.cs @@ -121,7 +121,11 @@ namespace Fungus new GUIContent("Character", "Character that is speaking"), new GUIContent(""), Character.activeCharacters); + + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PrefixLabel(" "); characterProp.objectReferenceValue = (Character) EditorGUILayout.ObjectField(characterProp.objectReferenceValue, typeof(Character), true); + EditorGUILayout.EndHorizontal(); Say t = target as Say;