|
|
|
@ -15,6 +15,8 @@ namespace Fungus
|
|
|
|
|
public Image continueImage; |
|
|
|
|
public AudioClip continueSound; |
|
|
|
|
|
|
|
|
|
protected Writer writer; |
|
|
|
|
|
|
|
|
|
public static SayDialog GetSayDialog() |
|
|
|
|
{ |
|
|
|
|
if (activeSayDialog == null) |
|
|
|
@ -43,41 +45,38 @@ namespace Fungus
|
|
|
|
|
return activeSayDialog; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected virtual void Start() |
|
|
|
|
protected Writer GetWriter() |
|
|
|
|
{ |
|
|
|
|
CanvasGroup canvasGroup = dialogCanvas.GetComponent<CanvasGroup>(); |
|
|
|
|
canvasGroup.alpha = 0f; |
|
|
|
|
if (writer != null) |
|
|
|
|
{ |
|
|
|
|
return writer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public virtual void Say(string text, bool clearPrevious, bool waitForInput, AudioClip voiceOverClip, Action onComplete) |
|
|
|
|
{ |
|
|
|
|
Writer writer = GetComponent<Writer>(); |
|
|
|
|
writer = GetComponent<Writer>(); |
|
|
|
|
if (writer == null) |
|
|
|
|
{ |
|
|
|
|
writer = gameObject.AddComponent<Writer>(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
ShowContinueImage(false); |
|
|
|
|
|
|
|
|
|
writer.Write(text, clearPrevious, waitForInput, onComplete); |
|
|
|
|
return writer; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override void Clear() |
|
|
|
|
protected virtual void Start() |
|
|
|
|
{ |
|
|
|
|
base.Clear(); |
|
|
|
|
ShowContinueImage(false); |
|
|
|
|
CanvasGroup canvasGroup = dialogCanvas.GetComponent<CanvasGroup>(); |
|
|
|
|
canvasGroup.alpha = 0f; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected virtual void OnWaitForInputTag(bool waiting) |
|
|
|
|
public virtual void Say(string text, bool clearPrevious, bool waitForInput, AudioClip voiceOverClip, Action onComplete) |
|
|
|
|
{ |
|
|
|
|
ShowContinueImage(waiting); |
|
|
|
|
GetWriter().Write(text, clearPrevious, waitForInput, onComplete); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
protected virtual void ShowContinueImage(bool visible) |
|
|
|
|
protected virtual void Update() |
|
|
|
|
{ |
|
|
|
|
if (continueImage != null) |
|
|
|
|
{ |
|
|
|
|
continueImage.enabled = visible; |
|
|
|
|
continueImage.enabled = GetWriter().isWaitingForInput; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|