diff --git a/src/scene-scripts/dialogue-system/dialog_bubble.cs b/src/scene-scripts/dialogue-system/dialog_bubble.cs index 0e586c0..6bc8ccf 100644 --- a/src/scene-scripts/dialogue-system/dialog_bubble.cs +++ b/src/scene-scripts/dialogue-system/dialog_bubble.cs @@ -41,13 +41,10 @@ public partial class dialog_bubble : CanvasLayer } public override void _Process(double delta) { - if (richText.VisibleCharacters < Regex.Replace(richText.Text, @"\[[^]]+\]", "").Length && GetNode("typewriter_timer").IsStopped()) - { - richText.VisibleCharacters++; - GetNode("typewriter_timer").Start(); - } if (Input.IsActionJustPressed("ui_cancel") && Visible) richText.VisibleCharacters = richText.Text.Length; - if (Input.IsActionJustPressed("ui_accept") && GetNode("box/panel_container").Visible == false && Visible && richText.VisibleCharacters == -1 | Regex.Replace(richText.Text, @"\[[^]]+\]", "").Length <= richText.VisibleCharacters) + + if (Input.IsActionJustPressed("ui_accept") && GetNode("box/panel_container").Visible == false && Visible + && richText.VisibleCharacters == -1 | Regex.Replace(richText.Text, @"\[[^]]+\]", "").Length <= richText.VisibleCharacters) { if (dlgPointer < dlgLines.AsGodotArray().Count) { @@ -62,11 +59,16 @@ public partial class dialog_bubble : CanvasLayer MakeAnswerBox(Json.ParseString(dlgLines.AsGodotArray()[dlgPointer].AsGodotDictionary().Keys.ToString()).AsStringArray()); GetNode("box/panel_container").Visible = true; } - } if (dlgLines.AsGodotArray()[dlgPointer].VariantType != Variant.Type.Dictionary) dlgPointer++; } + if (richText.VisibleCharacters < Regex.Replace(richText.Text, @"\[[^]]+\]", "").Length && GetNode("typewriter_timer").IsStopped()) + { + richText.VisibleCharacters++; + GetNode("typewriter_timer").Start(); + } + if (dlgPointer > dlgLines.AsGodotArray().Count) CloseDialog(); }