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);
    }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
    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);
    }
Ejemplo n.º 4
0
    private void OnEnable()
    {
        TypedText.TypedTextSettings typedTextSettings = new TypedText.TypedTextSettings();
        typedTextSettings.splitMode        = TypedText.TypedTextSettings.SplitMode.Character;
        typedTextSettings.defaultTypeDelay = new TypedText.RandomTimeDelay(letterTypeTime.x, letterTypeTime.y);

        typedText = new TypedText();
        typedText.TypeText(content, typedTextSettings);
        typedText.OnTypeText += OnTypeText;
        text.text             = "";

        Canvas.ForceUpdateCanvases();

        TextGenerator          textGenerator         = new TextGenerator();
        TextGenerationSettings textGeneratorSettings = text.GetGenerationSettings(new Vector2(0, 100));

        textGeneratorSettings.updateBounds = true;
        textGeneratorSettings.scaleFactor  = 1;
        textGenerator.Populate(content, textGeneratorSettings);
        rectTransform.sizeDelta = new Vector2(textGenerator.rectExtents.width * 2, rectTransform.sizeDelta.y);
        text.alignment          = TextAnchor.MiddleLeft;
    }