diff --git a/scenes/gui/dialog_bubble.tscn b/scenes/gui/dialog_bubble.tscn index 6cfe6d8..0a9222e 100644 --- a/scenes/gui/dialog_bubble.tscn +++ b/scenes/gui/dialog_bubble.tscn @@ -9,6 +9,7 @@ [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_5w2xu"] [node name="dialog_bubble" type="CanvasLayer"] +process_mode = 4 script = ExtResource("1_xtj1q") metadata/_edit_use_anchors_ = true @@ -113,4 +114,5 @@ metadata/_edit_lock_ = true stream = ExtResource("5_w6jq7") bus = &"UI" +[connection signal="visibility_changed" from="." to="." method="OnVisibilityChanged"] [connection signal="timeout" from="typewriter_timer" to="." method="OnTypewriterTimerTimeout"] diff --git a/src/scene-scripts/dialogue-system/dialog_bubble.cs b/src/scene-scripts/dialogue-system/dialog_bubble.cs index 3778515..33ada7f 100644 --- a/src/scene-scripts/dialogue-system/dialog_bubble.cs +++ b/src/scene-scripts/dialogue-system/dialog_bubble.cs @@ -53,6 +53,12 @@ public partial class dialog_bubble : CanvasLayer dlgLines = dlgLines.AsGodotArray()[GD.RandRange(0, dlgLines.AsGodotArray().Count - 1)]; //TODO:copy a clean default array and remove already used indexes and copy from clean array when its empty } + public void OnVisibilityChanged() + { + if (Visible) + ProcessMode = ProcessModeEnum.Inherit; + else ProcessMode = ProcessModeEnum.Disabled; + } public override void _Process(double delta) { DialogControlls(); @@ -60,9 +66,9 @@ public partial class dialog_bubble : CanvasLayer } public void DialogControlls() { - if (Input.IsActionJustPressed("ui_cancel") && Visible) richText.VisibleCharacters = richText.Text.Length; + if (Input.IsActionJustPressed("ui_cancel")) richText.VisibleCharacters = richText.Text.Length; - if (Input.IsActionJustPressed("ui_accept") && Visible && GetNode("box/panel_container").Visible == false + if (Input.IsActionJustPressed("ui_accept") && GetNode("box/panel_container").Visible == false && richText.VisibleCharacters == -1 | Regex.Replace(richText.Text, @"\[[^]]+\]", "").Length <= richText.VisibleCharacters) { if (dlgPointer < dlgLines.AsGodotArray().Count)