From cec3a13a664043803ba6cf072126c6de1c00694e Mon Sep 17 00:00:00 2001 From: vaporvee Date: Sun, 5 Feb 2023 10:56:31 +0100 Subject: [PATCH] more weird dialogue code --- scenes/gui/dialog_bubble.tscn | 1 + scenes/main.tscn | 2 +- .../dialogue-system/dialog_bubble.cs | 148 +++++++++--------- src/scene-scripts/player.cs | 107 +++++++------ 4 files changed, 131 insertions(+), 127 deletions(-) diff --git a/scenes/gui/dialog_bubble.tscn b/scenes/gui/dialog_bubble.tscn index 60b9b96..c9bb463 100644 --- a/scenes/gui/dialog_bubble.tscn +++ b/scenes/gui/dialog_bubble.tscn @@ -66,6 +66,7 @@ theme_override_font_sizes/font_size = 36 text = "???" [node name="panel_container" type="PanelContainer" parent="box"] +visible = false layout_mode = 1 anchors_preset = 3 anchor_left = 1.0 diff --git a/scenes/main.tscn b/scenes/main.tscn index 40f014f..7c99b14 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -8,4 +8,4 @@ [node name="first_world" parent="." instance=ExtResource("2_x8nyb")] [node name="player" parent="." instance=ExtResource("1_p5d84")] -playerName = "[rainbow]Yannik[/rainbow]" +playerName = "Yannik" diff --git a/src/scene-scripts/dialogue-system/dialog_bubble.cs b/src/scene-scripts/dialogue-system/dialog_bubble.cs index e435a6d..1f0208e 100644 --- a/src/scene-scripts/dialogue-system/dialog_bubble.cs +++ b/src/scene-scripts/dialogue-system/dialog_bubble.cs @@ -5,81 +5,79 @@ using System.Text.RegularExpressions; public partial class dialog_bubble : CanvasLayer { - public Variant parsedDlg; - public ArrayList dlgLines = new ArrayList(); - public int dlgPointer = 0; - public RichTextLabel richText; - public int dialogOptionsLength; + public Variant parsedDlg; + public ArrayList dlgLines = new ArrayList(); + public int dlgPointer = 0; + public RichTextLabel richText; + public int dialogOptionsLength = 1; - public override void _Ready() - { - richText = GetNode("box/rich_text_label"); - } - public void GetDialog(string file, string title, Variant actor, string playerName) - { - parsedDlg = Json.ParseString(FileAccess.Open(file, FileAccess.ModeFlags.Read).GetAsText().Replace("{player}", playerName)); - GetNode