From 0504eb36515c8341e8061a322ddeeebc0d25602a Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 7 Nov 2016 11:19:14 +0000 Subject: [PATCH 1/5] Change CSVParser to use Regex.Split (way faster) --- .../Fungus/Thirdparty/CSVParser/CsvParser.cs | 29 ++++++++++++------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/Assets/Fungus/Thirdparty/CSVParser/CsvParser.cs b/Assets/Fungus/Thirdparty/CSVParser/CsvParser.cs index ffc59201..aa70df58 100644 --- a/Assets/Fungus/Thirdparty/CSVParser/CsvParser.cs +++ b/Assets/Fungus/Thirdparty/CSVParser/CsvParser.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Text; +using System.Text.RegularExpressions; namespace Ideafixxxer.CsvParser { @@ -190,28 +191,36 @@ namespace Ideafixxxer.CsvParser var context = new ParserContext(); // Handle both Windows and Mac line endings - string[] lines = csvData.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries); + var lines = Regex.Split(csvData, "\n|\r\n"); ParserState currentState = ParserState.LineStartState; - foreach (string next in lines) - { - foreach (char ch in next) + for (int i = 0; i < lines.Length; i++) { + var next = lines [i]; + + // Skip empty entries + if (next.Length == 0) { - switch (ch) - { + continue; + } + + for (int j = 0; j < next.Length; j++) { + var ch = next [j]; + + switch (ch) { case CommaCharacter: - currentState = currentState.Comma(context); + currentState = currentState.Comma (context); break; case QuoteCharacter: - currentState = currentState.Quote(context); + currentState = currentState.Quote (context); break; default: - currentState = currentState.AnyChar(ch, context); + currentState = currentState.AnyChar (ch, context); break; } } - currentState = currentState.EndOfLine(context); + currentState = currentState.EndOfLine (context); } + List allLines = context.GetAllLines(); return allLines.ToArray(); } From 3382bbf92fc03c0ffeee46a51839dfa0ffbc0a8d Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 7 Nov 2016 14:31:00 +0000 Subject: [PATCH 2/5] Increased height of multi-line text box for StringDataMulti --- Assets/Fungus/Scripts/VariableTypes/StringVariable.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Fungus/Scripts/VariableTypes/StringVariable.cs b/Assets/Fungus/Scripts/VariableTypes/StringVariable.cs index efb8c4a5..ef0ec2cf 100644 --- a/Assets/Fungus/Scripts/VariableTypes/StringVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/StringVariable.cs @@ -96,7 +96,7 @@ namespace Fungus [VariableProperty("", typeof(StringVariable))] public StringVariable stringRef; - [TextArea(1,10)] + [TextArea(1,15)] [SerializeField] public string stringVal; From 9ae056a7699b0f76fd44202dfb780f1ff5f485de Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 7 Nov 2016 14:44:16 +0000 Subject: [PATCH 3/5] Fixed missing sprite assets in Asset Store version. --- .../FungusLua/Narrative/StageAndPortraits.unity | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Assets/FungusExamples/FungusLua/Narrative/StageAndPortraits.unity b/Assets/FungusExamples/FungusLua/Narrative/StageAndPortraits.unity index 53c51c9d..42a5f4a6 100644 --- a/Assets/FungusExamples/FungusLua/Narrative/StageAndPortraits.unity +++ b/Assets/FungusExamples/FungusLua/Narrative/StageAndPortraits.unity @@ -331,6 +331,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: parentBlock: {fileID: 574033268} + waitForFrames: 1 --- !u!114 &574033268 MonoBehaviour: m_ObjectHideFlags: 2 @@ -349,6 +350,8 @@ MonoBehaviour: y: 68.96694 width: 120 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 0 blockName: Start description: @@ -381,7 +384,7 @@ MonoBehaviour: y: -340 width: 1114 height: 859 - selectedBlock: {fileID: 574033268} + selectedBlocks: [] selectedCommands: - {fileID: 574033272} variables: [] @@ -903,7 +906,7 @@ MonoBehaviour: nameColor: {r: 1, g: 1, b: 1, a: 1} soundEffect: {fileID: 0} portraits: - - {fileID: 21300000, guid: a92b08a118b7d46f59dd091acb2e4102, type: 3} + - {fileID: 21300000, guid: e8a9122c4dc10b14da3b625e1f2634c9, type: 3} - {fileID: 21300000, guid: 03bc547cc0049594bae51f00903eedef, type: 3} portraitsFace: 0 setSayDialog: {fileID: 1231398849} @@ -954,7 +957,7 @@ MonoBehaviour: soundEffect: {fileID: 0} portraits: - {fileID: 21300000, guid: 8f5b5b110e73a414eb229eeead86200f, type: 3} - - {fileID: 21300000, guid: c779e34c6eb8e45da98c70cf2802a54c, type: 3} + - {fileID: 21300000, guid: 84cdbfde1b7d4c24ab7071894480d5db, type: 3} portraitsFace: 0 setSayDialog: {fileID: 1958712152} description: From 6d3f14b4b94a4f8af8d6c26af3aeeefe5abcba55 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 7 Nov 2016 14:45:19 +0000 Subject: [PATCH 4/5] Removed TestRunner game objects from DragAndDrop examples. --- .../DragAndDrop(EventSystem).unity | 60 ++++++------------- .../DragAndDrop/DragAndDrop.unity | 60 ++++++------------- 2 files changed, 36 insertions(+), 84 deletions(-) diff --git a/Assets/FungusExamples/DragAndDrop/DragAndDrop(EventSystem).unity b/Assets/FungusExamples/DragAndDrop/DragAndDrop(EventSystem).unity index 42fbfa00..d3e2421a 100644 --- a/Assets/FungusExamples/DragAndDrop/DragAndDrop(EventSystem).unity +++ b/Assets/FungusExamples/DragAndDrop/DragAndDrop(EventSystem).unity @@ -627,47 +627,6 @@ CircleCollider2D: m_PrefabParentObject: {fileID: 5800000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} m_PrefabInternal: {fileID: 442175927} ---- !u!1 &807929237 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 807929239} - - 114: {fileID: 807929238} - m_Layer: 0 - m_Name: TestRunner - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &807929238 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 807929237} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5c3afc1c624179749bcdecf7b0224902, type: 3} - m_Name: - m_EditorClassIdentifier: - currentTest: {fileID: 0} ---- !u!4 &807929239 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 807929237} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 10 --- !u!1 &1081858233 stripped GameObject: m_PrefabParentObject: {fileID: 100000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} @@ -997,7 +956,7 @@ MonoBehaviour: y: -452 width: 1887 height: 1080 - selectedBlock: {fileID: 2019116698} + selectedBlocks: [] selectedCommands: - {fileID: 2019116697} variables: [] @@ -1030,6 +989,8 @@ MonoBehaviour: y: 29 width: 197 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 17 blockName: Drag Completed description: @@ -1240,6 +1201,8 @@ MonoBehaviour: y: 132 width: 197 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 16 blockName: Drag Exited description: @@ -1294,6 +1257,8 @@ MonoBehaviour: y: 133 width: 197 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 15 blockName: Drag Entered description: @@ -1332,6 +1297,8 @@ MonoBehaviour: y: 30 width: 136 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 14 blockName: Drag Cancelled description: @@ -1370,6 +1337,8 @@ MonoBehaviour: y: 27 width: 136 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 13 blockName: Drag Start description: @@ -1523,6 +1492,8 @@ MonoBehaviour: y: 29 width: 137 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 18 blockName: Object Clicked 1 description: @@ -1546,6 +1517,8 @@ MonoBehaviour: y: 31 width: 137 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 19 blockName: Object Clicked 2 description: @@ -1630,6 +1603,8 @@ MonoBehaviour: y: -50 width: 120 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 20 blockName: Start description: @@ -1648,6 +1623,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: parentBlock: {fileID: 2019116698} + waitForFrames: 1 --- !u!1 &2096462794 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/FungusExamples/DragAndDrop/DragAndDrop.unity b/Assets/FungusExamples/DragAndDrop/DragAndDrop.unity index 1080282b..20d335cb 100644 --- a/Assets/FungusExamples/DragAndDrop/DragAndDrop.unity +++ b/Assets/FungusExamples/DragAndDrop/DragAndDrop.unity @@ -608,47 +608,6 @@ CircleCollider2D: m_PrefabParentObject: {fileID: 5800000, guid: 4442b79fcbcbb4aac97f42d6dc3d4e0b, type: 2} m_PrefabInternal: {fileID: 442175927} ---- !u!1 &807929237 -GameObject: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - serializedVersion: 4 - m_Component: - - 4: {fileID: 807929239} - - 114: {fileID: 807929238} - m_Layer: 0 - m_Name: TestRunner - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &807929238 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 807929237} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 5c3afc1c624179749bcdecf7b0224902, type: 3} - m_Name: - m_EditorClassIdentifier: - currentTest: {fileID: 0} ---- !u!4 &807929239 -Transform: - m_ObjectHideFlags: 0 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 0} - m_GameObject: {fileID: 807929237} - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_Children: [] - m_Father: {fileID: 0} - m_RootOrder: 10 --- !u!1 &1081858233 stripped GameObject: m_PrefabParentObject: {fileID: 100000, guid: 4d55f86cf3b124c8fb1158da26ffa96d, type: 2} @@ -979,7 +938,7 @@ MonoBehaviour: y: -452 width: 1887 height: 1080 - selectedBlock: {fileID: 2019116698} + selectedBlocks: [] selectedCommands: [] variables: [] description: 'This scene shows how to set up a drag-and-drop @@ -1011,6 +970,8 @@ MonoBehaviour: y: 29 width: 197 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 17 blockName: Drag Completed description: @@ -1221,6 +1182,8 @@ MonoBehaviour: y: 132 width: 197 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 16 blockName: Drag Exited description: @@ -1275,6 +1238,8 @@ MonoBehaviour: y: 133 width: 197 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 15 blockName: Drag Entered description: @@ -1313,6 +1278,8 @@ MonoBehaviour: y: 30 width: 136 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 14 blockName: Drag Cancelled description: @@ -1351,6 +1318,8 @@ MonoBehaviour: y: 27 width: 136 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 13 blockName: Drag Start description: @@ -1504,6 +1473,8 @@ MonoBehaviour: y: 29 width: 137 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 18 blockName: Object Clicked 1 description: @@ -1527,6 +1498,8 @@ MonoBehaviour: y: 31 width: 137 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 19 blockName: Object Clicked 2 description: @@ -1611,6 +1584,8 @@ MonoBehaviour: y: -50 width: 120 height: 40 + tint: {r: 1, g: 1, b: 1, a: 1} + useCustomTint: 0 itemId: 20 blockName: Start description: @@ -1629,6 +1604,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: parentBlock: {fileID: 2019116698} + waitForFrames: 1 --- !u!1 &2096462794 GameObject: m_ObjectHideFlags: 0 From 8d38ea62a780c7fac93219f8c0887db129b33812 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 7 Nov 2016 14:47:21 +0000 Subject: [PATCH 5/5] Fixed onComplete callback in MusicManager.SetAudioVolume when duration is 0 --- Assets/Fungus/Scripts/Components/MusicManager.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Assets/Fungus/Scripts/Components/MusicManager.cs b/Assets/Fungus/Scripts/Components/MusicManager.cs index 214fad29..bdae88c5 100644 --- a/Assets/Fungus/Scripts/Components/MusicManager.cs +++ b/Assets/Fungus/Scripts/Components/MusicManager.cs @@ -113,6 +113,10 @@ namespace Fungus if (Mathf.Approximately(duration, 0f)) { + if (onComplete != null) + { + onComplete(); + } audio.volume = volume; return; }