From 209a701afbc6bd45eb23e8e9e292cbafcee830a0 Mon Sep 17 00:00:00 2001 From: Christopher Date: Mon, 12 Sep 2016 15:01:22 +0100 Subject: [PATCH] Moved all public SayDialog methods to ISayDialog interface --- Assets/Fungus/Narrative/Scripts/ISayDialog.cs | 11 +++++- Assets/Fungus/Narrative/Scripts/SayDialog.cs | 38 +++++++++---------- 2 files changed, 29 insertions(+), 20 deletions(-) diff --git a/Assets/Fungus/Narrative/Scripts/ISayDialog.cs b/Assets/Fungus/Narrative/Scripts/ISayDialog.cs index dd93b925..e682587d 100644 --- a/Assets/Fungus/Narrative/Scripts/ISayDialog.cs +++ b/Assets/Fungus/Narrative/Scripts/ISayDialog.cs @@ -22,9 +22,13 @@ namespace Fungus /// /// Sets the character image to display on the Say Dialog. /// - /// Image. void SetCharacterImage(Sprite image); + /// + /// Sets the character name to display on the Say Dialog. + /// + void SetCharacterName(string name, Color color); + /// /// Write a line of story text to the Say Dialog. /// @@ -46,5 +50,10 @@ namespace Fungus /// Stop the Say Dialog while its writing text. /// void Stop(); + + /// + /// Stops writing text and clears the Say Dialog. + /// + void Clear(); } } \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/SayDialog.cs b/Assets/Fungus/Narrative/Scripts/SayDialog.cs index fda8059a..5f7923ee 100644 --- a/Assets/Fungus/Narrative/Scripts/SayDialog.cs +++ b/Assets/Fungus/Narrative/Scripts/SayDialog.cs @@ -158,7 +158,7 @@ namespace Fungus } } - public virtual IEnumerator SayInternal(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, AudioClip voiceOverClip, Action onComplete) + protected virtual IEnumerator SayInternal(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, AudioClip voiceOverClip, Action onComplete) { IWriter writer = GetWriter(); @@ -238,23 +238,6 @@ namespace Fungus } } - public virtual void SetCharacterName(string name, Color color) - { - if (nameText != null) - { - nameText.text = name; - nameText.color = color; - } - } - - public virtual void Clear() - { - ClearStoryText(); - - // Kill any active write coroutine - StopAllCoroutines(); - } - protected virtual void ClearStoryText() { if (storyText != null) @@ -262,7 +245,7 @@ namespace Fungus storyText.text = ""; } } - + public static void StopPortraitTweens() { // Stop all tweening portraits @@ -406,6 +389,15 @@ namespace Fungus } } + public virtual void SetCharacterName(string name, Color color) + { + if (nameText != null) + { + nameText.text = name; + nameText.color = color; + } + } + public virtual void Say(string text, bool clearPrevious, bool waitForInput, bool fadeWhenDone, bool stopVoiceover, AudioClip voiceOverClip, Action onComplete) { StartCoroutine(SayInternal(text, clearPrevious, waitForInput, fadeWhenDone, stopVoiceover, voiceOverClip, onComplete)); @@ -419,6 +411,14 @@ namespace Fungus GetWriter().Stop(); } + public virtual void Clear() + { + ClearStoryText(); + + // Kill any active write coroutine + StopAllCoroutines(); + } + #endregion } }