public void AppendText(string content)
    {
        base.LayoutText(text.text + " " + content);

        TypedText.TypedTextSettings textTyperSettings = new TypedText.TypedTextSettings();
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay(",", new TypedText.RandomTimeDelay(0.075f, 0.1f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay(":", new TypedText.RandomTimeDelay(0.125f, 0.175f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay("-", new TypedText.RandomTimeDelay(0.125f, 0.175f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay(".", new TypedText.RandomTimeDelay(0.3f, 0.4f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay("\n", new TypedText.RandomTimeDelay(0.5f, 0.6f)));
        if (Main.Instance.gameState.hasMadeAChoice)
        {
            textTyperSettings.splitMode        = TypedText.TypedTextSettings.SplitMode.Word;
            textTyperSettings.defaultTypeDelay = new TypedText.RandomTimeDelay(0.04f, 0.065f);
        }
        else
        {
            textTyperSettings.splitMode        = TypedText.TypedTextSettings.SplitMode.Character;
            textTyperSettings.defaultTypeDelay = new TypedText.RandomTimeDelay(0.03f, 0.0425f);
        }

        startText                   = text.text;
        richText                    = new RichTextSubstring(content);
        textTyper                   = new TypedText();
        textTyper.OnTypeText       += OnAppendText;
        textTyper.OnCompleteTyping += CompleteTyping;
        textTyper.TypeText(richText.plainText, textTyperSettings);
    }
    public override void LayoutText(string content)
    {
        //base.LayoutText (content);

        TypedText.TypedTextSettings textTyperSettings = new TypedText.TypedTextSettings();
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay(",", new TypedText.RandomTimeDelay(0.075f, 0.1f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay(":", new TypedText.RandomTimeDelay(0.125f, 0.175f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay("-", new TypedText.RandomTimeDelay(0.125f, 0.175f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay(".", new TypedText.RandomTimeDelay(0.3f, 0.4f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay("\n", new TypedText.RandomTimeDelay(0.5f, 0.6f)));
        if (Main.Instance.gameState.hasMadeAChoice)
        {
            textTyperSettings.splitMode        = TypedText.TypedTextSettings.SplitMode.Character;
            textTyperSettings.defaultTypeDelay = new TypedText.RandomTimeDelay(0.06f, 0.09f);
        }
        else
        {
            textTyperSettings.splitMode        = TypedText.TypedTextSettings.SplitMode.Character;
            textTyperSettings.defaultTypeDelay = new TypedText.RandomTimeDelay(0.05f, 0.09f);
        }

        richText                    = new RichTextSubstring(content);
        textTyper                   = new TypedText();
        textTyper.OnTypeText       += OnTypeText;
        textTyper.OnCompleteTyping += CompleteTyping;
        textTyper.TypeText(richText.plainText, textTyperSettings);

        // richText = new RichTextSubstring (content);
        // textTyper = new TypedText();
        // textTyper.OnTypeText += "c";
        // textTyper.OnCompleteTyping += "b";
        // textTyper.TypeText(richText.plainText, textTyperSettings);
    }
    public void SubstringReturnsWellFormattedRichText()
    {
        RichTextSubstring rts = new RichTextSubstring("<i>foo</i> bar");

        Assert.AreEqual("<i>f</i>", rts.Substring(0, 1));
        Assert.AreEqual("<i>fo</i>", rts.Substring(0, 2));
        Assert.AreEqual("<i>foo</i>", rts.Substring(0, 3));
        Assert.AreEqual("<i>foo</i> ", rts.Substring(0, 4));
        Assert.AreEqual("<i>foo</i> b", rts.Substring(0, 5));
        Assert.AreEqual("<i>foo</i> ba", rts.Substring(0, 6));
        Assert.AreEqual("<i>foo</i> bar", rts.Substring(0, 7));

        Assert.AreEqual("<i>oo</i>", rts.Substring(1, 2));
        Assert.AreEqual("<i>o</i>", rts.Substring(1, 1));
        Assert.AreEqual("<i>o</i> ba", rts.Substring(2, 4));
    }
    public void SubstringReturnsWellFormattedRichText()
    {
        RichTextSubstring rts = new RichTextSubstring("<i>foo</i> bar");

        Assert.AreEqual ("<i>f</i>", rts.Substring (0, 1));
        Assert.AreEqual ("<i>fo</i>", rts.Substring (0, 2));
        Assert.AreEqual ("<i>foo</i>", rts.Substring (0, 3));
        Assert.AreEqual ("<i>foo</i> ", rts.Substring (0, 4));
        Assert.AreEqual ("<i>foo</i> b", rts.Substring (0, 5));
        Assert.AreEqual ("<i>foo</i> ba", rts.Substring (0, 6));
        Assert.AreEqual ("<i>foo</i> bar", rts.Substring (0, 7));

        Assert.AreEqual ("<i>oo</i>", rts.Substring (1, 2));
        Assert.AreEqual ("<i>o</i>", rts.Substring (1, 1));
        Assert.AreEqual ("<i>o</i> ba", rts.Substring (2, 4));
    }
    public void DeleteText(string content)
    {
        base.LayoutText(text.text);

        TypedText.TypedTextSettings textTyperSettings = new TypedText.TypedTextSettings();
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay(",", new TypedText.RandomTimeDelay(0.075f, 0.1f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay(":", new TypedText.RandomTimeDelay(0.125f, 0.175f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay("-", new TypedText.RandomTimeDelay(0.125f, 0.175f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay(".", new TypedText.RandomTimeDelay(0.3f, 0.4f)));
        textTyperSettings.customPostTypePause.Add(new TypedText.CustomStringTimeDelay("\n", new TypedText.RandomTimeDelay(0.5f, 0.6f)));

        textTyperSettings.splitMode        = TypedText.TypedTextSettings.SplitMode.Character;
        textTyperSettings.defaultTypeDelay = new TypedText.RandomTimeDelay(0.03f, 0.0425f);

        startText                   = text.text;
        richText                    = new RichTextSubstring(text.text);
        textTyper                   = new TypedText();
        textTyper.OnTypeText       += OnDeleteText;
        textTyper.OnCompleteTyping += CompleteTyping;
        textTyper.TypeText(richText.plainText, textTyperSettings);
    }
    public void ItSetsPlainText()
    {
        RichTextSubstring rts = new RichTextSubstring("<i>foo</i> bar");

        Assert.AreEqual("foo bar", rts.plainText);
    }
 public void ItSetsPlainText()
 {
     RichTextSubstring rts = new RichTextSubstring("<i>foo</i> bar");
     Assert.AreEqual ("foo bar", rts.plainText);
 }