From c660b0f1d56c30a02dcf2ad5503315fea930bfad Mon Sep 17 00:00:00 2001 From: cmod31 Date: Wed, 8 Feb 2023 14:48:00 +0100 Subject: [PATCH] added dialogue EventIDs --- src/scene-scripts/dialogue-system/dialog_bubble.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/scene-scripts/dialogue-system/dialog_bubble.cs b/src/scene-scripts/dialogue-system/dialog_bubble.cs index 8311619..2902d9a 100644 --- a/src/scene-scripts/dialogue-system/dialog_bubble.cs +++ b/src/scene-scripts/dialogue-system/dialog_bubble.cs @@ -13,8 +13,7 @@ public partial class dialog_bubble : CanvasLayer - add controller support for answerboxes - add tree support (example: "story" key) - ability to add dialogue begin answers on the fly (special ones are colored) - they will be in an dictionary with numbers as event IDs and the event ID will - be used with a switch case or a string key with a event ID later in the dialogue like event 0 (close)*/ + they will be in a dictionary with event IDs or Dictionary keys*/ public override void _Ready() { richText = GetNode("box/rich_text_label"); @@ -60,7 +59,7 @@ public partial class dialog_bubble : CanvasLayer { GD.Print(dlgLines.AsGodotArray()[dlgPointer].VariantType); if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.Float && ((float)dlgLines.AsGodotArray()[dlgPointer]) == 0) - CloseDialog(); + InDialogEvents((int)dlgLines.AsGodotArray()[dlgPointer]); else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.String) UpdateDialog(); else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.Dictionary) @@ -117,4 +116,13 @@ public partial class dialog_bubble : CanvasLayer } GetNode("box/panel_container").Visible = true; } + public void InDialogEvents(int eventID) + { + switch (eventID) + { + case 0: + CloseDialog(); + break; + } + } } \ No newline at end of file