Browse Source

Moved all public SayDialog methods to ISayDialog interface

master
Christopher 9 years ago
parent
commit
209a701afb
  1. 11
      Assets/Fungus/Narrative/Scripts/ISayDialog.cs
  2. 38
      Assets/Fungus/Narrative/Scripts/SayDialog.cs

11
Assets/Fungus/Narrative/Scripts/ISayDialog.cs

@ -22,9 +22,13 @@ namespace Fungus
/// <summary> /// <summary>
/// Sets the character image to display on the Say Dialog. /// Sets the character image to display on the Say Dialog.
/// </summary> /// </summary>
/// <param name="image">Image.</param>
void SetCharacterImage(Sprite image); void SetCharacterImage(Sprite image);
/// <summary>
/// Sets the character name to display on the Say Dialog.
/// </summary>
void SetCharacterName(string name, Color color);
/// <summary> /// <summary>
/// Write a line of story text to the Say Dialog. /// Write a line of story text to the Say Dialog.
/// </summary> /// </summary>
@ -46,5 +50,10 @@ namespace Fungus
/// Stop the Say Dialog while its writing text. /// Stop the Say Dialog while its writing text.
/// </summary> /// </summary>
void Stop(); void Stop();
/// <summary>
/// Stops writing text and clears the Say Dialog.
/// </summary>
void Clear();
} }
} }

38
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(); 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() protected virtual void ClearStoryText()
{ {
if (storyText != null) if (storyText != null)
@ -262,7 +245,7 @@ namespace Fungus
storyText.text = ""; storyText.text = "";
} }
} }
public static void StopPortraitTweens() public static void StopPortraitTweens()
{ {
// Stop all tweening portraits // 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) 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)); StartCoroutine(SayInternal(text, clearPrevious, waitForInput, fadeWhenDone, stopVoiceover, voiceOverClip, onComplete));
@ -419,6 +411,14 @@ namespace Fungus
GetWriter().Stop(); GetWriter().Stop();
} }
public virtual void Clear()
{
ClearStoryText();
// Kill any active write coroutine
StopAllCoroutines();
}
#endregion #endregion
} }
} }

Loading…
Cancel
Save