Пример #1
0
    /// <summary>
    /// Run the given snippet, showing it for the given period of time then hiding it.
    /// </summary>
    /// <param name="snippet"></param>
    /// <returns></returns>
    public IEnumerator RunDialogueSnippet(Dialogue.Snippet snippet)
    {
        if (!Enabled)
        {
            // NB: anything playing audio should wait until that has completed.
            yield break;
        }

        // In case there is a delay we want to clear the text before waiting.
        if (snippet.Delay > 0)
        {
            Clear();
            yield return(new WaitForSeconds(snippet.Delay));
        }

        // Empty snippet implies clear.
        if (snippet.Text == "")
        {
            Clear();
            yield return(new WaitForSeconds(snippet.Time));

            yield break;
        }

        if (!ClosedCaptions && snippet.ClosedCaption || OnShowText == null)
        {
            yield return(new WaitForSeconds(snippet.Time));

            yield break;
        }

        OnShowText.Invoke(SetSource(snippet.Source), snippet);
        yield return(new WaitForSeconds(snippet.Time));
    }
Пример #2
0
    private void OnShowClosedCaption(DialogueSource source, Dialogue.Snippet snippet)
    {
        if (source != null)
        {
            Debug.Log("Source: " + source.Name);
        }

        Debug.Log("Closed Caption: " + snippet.Text);
    }
Пример #3
0
    public void OnShowText(DialogueSource source, Dialogue.Snippet snippet)
    {
        if (source != null)
        {
            Label.color = source.SubtitleColor;
        }

        Label.SetText(snippet.Render(source));
        Label.gameObject.SetActive(true);
    }
Пример #4
0
 private void OnShowText(DialogueSource source, Dialogue.Snippet snippet)
 {
     Debug.Log(snippet.Render(source));
 }