From 61db98ac837ca8675da90ea55a36d2fb9791c116 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Wed, 27 Aug 2014 14:14:05 +0100 Subject: [PATCH] Fixed dialog layout. Initial coroutine say command. --- Assets/Fungus/Dialog/Commands/Say.cs | 16 +++++----- Assets/Fungus/Dialog/Commands/SetDialog.cs | 2 +- .../Fungus/Dialog/Editor/CharacterEditor.cs | 1 + Assets/Fungus/Dialog/Scripts/Dialog.cs | 28 +++++++++++++----- Assets/Shuttle/ShuttleGame.unity | Bin 101652 -> 101884 bytes 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/Assets/Fungus/Dialog/Commands/Say.cs b/Assets/Fungus/Dialog/Commands/Say.cs index 2d801176..07c458cf 100644 --- a/Assets/Fungus/Dialog/Commands/Say.cs +++ b/Assets/Fungus/Dialog/Commands/Say.cs @@ -9,7 +9,7 @@ namespace Fungus.Script [HelpText("Writes a line of story text to the dialog. A list of options can be specified for the player to choose from. Use a non-zero timeout to give the player a limited time to choose.")] public class Say : FungusCommand { - static public Dialog dialogController; + static public Dialog dialog; public Character character; public string storyText; @@ -30,7 +30,7 @@ namespace Fungus.Script public override void OnEnter() { - if (dialogController == null) + if (dialog == null) { Continue(); return; @@ -44,9 +44,9 @@ namespace Fungus.Script executionCount++; - dialogController.ShowDialog(true); + dialog.ShowDialog(true); - dialogController.SetCharacter(character); + dialog.SetCharacter(character); if (options.Count > 0) { @@ -59,7 +59,7 @@ namespace Fungus.Script dialogOption.onSelect = delegate { - dialogController.ShowDialog(false); + dialog.ShowDialog(false); if (onSelectSequence == null) { @@ -74,12 +74,12 @@ namespace Fungus.Script dialogOptions.Add(dialogOption); } - dialogController.Say(storyText, dialogOptions); + dialog.Say(storyText, dialogOptions); } else { - dialogController.Say(storyText, delegate { - dialogController.ShowDialog(false); + dialog.Say(storyText, delegate { + dialog.ShowDialog(false); Continue(); }); } diff --git a/Assets/Fungus/Dialog/Commands/SetDialog.cs b/Assets/Fungus/Dialog/Commands/SetDialog.cs index 2c039ff5..8f6c0d98 100644 --- a/Assets/Fungus/Dialog/Commands/SetDialog.cs +++ b/Assets/Fungus/Dialog/Commands/SetDialog.cs @@ -16,7 +16,7 @@ namespace Fungus.Script { if (dialogController != null) { - Say.dialogController = dialogController; + Say.dialog = dialogController; } Continue(); diff --git a/Assets/Fungus/Dialog/Editor/CharacterEditor.cs b/Assets/Fungus/Dialog/Editor/CharacterEditor.cs index 38a72658..2230ed19 100644 --- a/Assets/Fungus/Dialog/Editor/CharacterEditor.cs +++ b/Assets/Fungus/Dialog/Editor/CharacterEditor.cs @@ -16,6 +16,7 @@ namespace Fungus.Script if (shader != null) { spriteMaterial = new Material(shader); + spriteMaterial.hideFlags = HideFlags.DontSave; } } diff --git a/Assets/Fungus/Dialog/Scripts/Dialog.cs b/Assets/Fungus/Dialog/Scripts/Dialog.cs index 9ec4b365..11b24e4a 100644 --- a/Assets/Fungus/Dialog/Scripts/Dialog.cs +++ b/Assets/Fungus/Dialog/Scripts/Dialog.cs @@ -107,27 +107,39 @@ namespace Fungus.Script storyText.text = text; } - // TODO: Wait for text to finish writing - - ShowContinueIcon(true); - StartCoroutine(WaitForInput(onComplete)); + StartCoroutine(WriteText(text, delegate { + ShowContinueIcon(true); + StartCoroutine(WaitForInput(onComplete)); + })); } public void Say(string text, List