From 53ea811cb1de7c4a16f4170f130275a6abe679e8 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Fri, 21 Aug 2015 09:45:21 +0100 Subject: [PATCH] Fixed say dialog not being visible at start --- .../Narrative/Resources/SayDialog.prefab | 25 --- Assets/Fungus/Narrative/Scripts/SayDialog.cs | 12 +- Assets/Tests/Narrative/NarrativeTests.unity | 182 +++++++++++++++++- 3 files changed, 191 insertions(+), 28 deletions(-) diff --git a/Assets/Fungus/Narrative/Resources/SayDialog.prefab b/Assets/Fungus/Narrative/Resources/SayDialog.prefab index 9e252f31..1bca86d0 100644 --- a/Assets/Fungus/Narrative/Resources/SayDialog.prefab +++ b/Assets/Fungus/Narrative/Resources/SayDialog.prefab @@ -82,7 +82,6 @@ GameObject: - 224: {fileID: 22488900} - 222: {fileID: 22288900} - 114: {fileID: 11488904} - - 225: {fileID: 22588894} - 114: {fileID: 11478524} m_Layer: 5 m_Name: Panel @@ -345,26 +344,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3a0bbe22c246e4c78ad8e9816cbae9d5, type: 3} m_Name: m_EditorClassIdentifier: - writingSpeed: 30 - writingSound: {fileID: 8300000, guid: f637c5ce9d10e45c7855ed89bfc6b97e, type: 3} - writingVolume: 1 - loopWritingSound: 1 - beepPerCharacter: 0 - slowBeepsAt: 10 - fastBeepsAt: 30 - punctuationPause: .200000003 alwaysFadeDialog: 0 fadeDuration: .25 fadeEaseType: 0 - alwaysMoveDialog: 0 - startPosition: {x: 0, y: 0} - moveSpeed: 1000 - moveEaseType: 0 dialogCanvas: {fileID: 22388894} nameText: {fileID: 11488900} storyText: {fileID: 11488896} characterImage: {fileID: 11448914} - characterTypingSound: {fileID: 0} continueImage: {fileID: 11488898} continueSound: {fileID: 0} --- !u!114 &11488896 @@ -662,17 +648,6 @@ RectTransform: m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 0} ---- !u!225 &22588894 -CanvasGroup: - m_ObjectHideFlags: 1 - m_PrefabParentObject: {fileID: 0} - m_PrefabInternal: {fileID: 100100000} - m_GameObject: {fileID: 188900} - m_Enabled: 1 - m_Alpha: 1 - m_Interactable: 1 - m_BlocksRaycasts: 1 - m_IgnoreParentGroups: 0 --- !u!225 &22588896 CanvasGroup: m_ObjectHideFlags: 1 diff --git a/Assets/Fungus/Narrative/Scripts/SayDialog.cs b/Assets/Fungus/Narrative/Scripts/SayDialog.cs index 0b359b9c..35db2ac7 100644 --- a/Assets/Fungus/Narrative/Scripts/SayDialog.cs +++ b/Assets/Fungus/Narrative/Scripts/SayDialog.cs @@ -14,6 +14,7 @@ namespace Fungus public Image continueImage; public AudioClip continueSound; + public bool visibleAtStart; protected Writer writer; @@ -38,6 +39,7 @@ namespace Fungus go.SetActive(false); go.name = "SayDialog"; activeSayDialog = go.GetComponent(); + activeSayDialog.visibleAtStart = true; } } } @@ -63,8 +65,16 @@ namespace Fungus protected virtual void Start() { + // Set dialog visibilty at startup CanvasGroup canvasGroup = dialogCanvas.GetComponent(); - canvasGroup.alpha = 0f; + if (visibleAtStart) + { + canvasGroup.alpha = 1f; + } + else + { + canvasGroup.alpha = 0f; + } } public virtual void Say(string text, bool clearPrevious, bool waitForInput, AudioClip voiceOverClip, Action onComplete) diff --git a/Assets/Tests/Narrative/NarrativeTests.unity b/Assets/Tests/Narrative/NarrativeTests.unity index 12de72a9..19dc9e31 100644 --- a/Assets/Tests/Narrative/NarrativeTests.unity +++ b/Assets/Tests/Narrative/NarrativeTests.unity @@ -114,7 +114,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 61dddfdc5e0e44ca298d8f46f7f5a915, type: 3} m_Name: m_EditorClassIdentifier: - selectedFlowchart: {fileID: 24983358} + selectedFlowchart: {fileID: 736071350} --- !u!4 &11556238 Transform: m_ObjectHideFlags: 1 @@ -788,6 +788,134 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: passCount: 0 +--- !u!1 &736071346 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 142980, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 736071351} + - 114: {fileID: 736071350} + - 114: {fileID: 736071349} + - 114: {fileID: 736071348} + - 114: {fileID: 736071347} + m_Layer: 0 + m_Name: Flowchart + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &736071347 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 736071346} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: ec422cd568a9c4a31ad7c36d0572b9da, type: 3} + m_Name: + m_EditorClassIdentifier: + itemId: 1 + errorMessage: + indentLevel: 0 + storyText: Play audio beeps from dialog + description: + character: {fileID: 0} + portrait: {fileID: 0} + voiceOverClip: {fileID: 0} + showAlways: 1 + showCount: 1 + extendPrevious: 0 + fadeIn: 0 + fadeOut: 0 + waitForClick: 1 + setSayDialog: {fileID: 0} +--- !u!114 &736071348 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 11462346, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 736071346} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d2f6487d21a03404cb21b245f0242e79, type: 3} + m_Name: + m_EditorClassIdentifier: + parentBlock: {fileID: 736071349} +--- !u!114 &736071349 +MonoBehaviour: + m_ObjectHideFlags: 2 + m_PrefabParentObject: {fileID: 11433304, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 736071346} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3d3d73aef2cfc4f51abf34ac00241f60, type: 3} + m_Name: + m_EditorClassIdentifier: + nodeRect: + serializedVersion: 2 + x: 66 + y: 69 + width: 120 + height: 40 + itemId: 0 + blockName: Start + description: + eventHandler: {fileID: 736071348} + commandList: + - {fileID: 736071347} +--- !u!114 &736071350 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 11430050, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, + type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 736071346} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7a334fe2ffb574b3583ff3b18b4792d3, type: 3} + m_Name: + m_EditorClassIdentifier: + version: 1.0 + scrollPos: {x: 0, y: 0} + variablesScrollPos: {x: 0, y: 0} + variablesExpanded: 1 + blockViewHeight: 400 + zoom: 1 + scrollViewRect: + serializedVersion: 2 + x: -343 + y: -340 + width: 1114 + height: 859 + selectedBlock: {fileID: 736071349} + selectedCommands: + - {fileID: 736071347} + variables: [] + description: + stepPause: 0 + colorCommands: 1 + hideComponents: 1 + saveSelection: 1 + localizationId: +--- !u!4 &736071351 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 467082, guid: 5e7fbc8d4eb714b279eeeef2262c1e1a, type: 2} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 736071346} + 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_Children: [] + m_Father: {fileID: 1929911610} + m_RootOrder: 0 --- !u!1 &891159641 GameObject: m_ObjectHideFlags: 0 @@ -1823,7 +1951,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!4 &1731000812 Transform: m_ObjectHideFlags: 0 @@ -1860,6 +1988,56 @@ MonoBehaviour: platformsToIgnore: [] dynamic: 0 dynamicTypeName: +--- !u!1 &1929911609 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 4 + m_Component: + - 4: {fileID: 1929911610} + - 114: {fileID: 1929911611} + m_Layer: 0 + m_Name: AudioTest + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &1929911610 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1929911609} + 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_Children: + - {fileID: 736071351} + m_Father: {fileID: 0} + m_RootOrder: 5 +--- !u!114 &1929911611 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 1929911609} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: b1dba0b27b0864740a8720e920aa88c0, type: 3} + m_Name: + m_EditorClassIdentifier: + timeout: 5 + ignored: 0 + succeedAfterAllAssertionsAreExecuted: 0 + expectException: 0 + expectedExceptionList: + succeedWhenExceptionIsThrown: 0 + includedPlatforms: -1 + platformsToIgnore: [] + dynamic: 0 + dynamicTypeName: --- !u!1 &2084461894 GameObject: m_ObjectHideFlags: 0