From deab7140f9415f0f5fea9240a291b976e507593f Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Fri, 14 Apr 2023 11:32:40 -0400 Subject: Created rudimentary message display It shows when the player sends a location or receives an item. Currently it just shows IDs instead of names. We need to download all data packages so that we can read the names. We are also currently queueing a message when we send a location, which isn't the best because if that location turns out to contain an item for us, we'll get two messages. It would be better to hold off until we receive a PrintJSON message describing the location that was sent out. We also now cache the ID of the most recently processed item, so that on relaunch we know which items are new and should be announced. --- Archipelago/messages.gd | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Archipelago/messages.gd (limited to 'Archipelago/messages.gd') diff --git a/Archipelago/messages.gd b/Archipelago/messages.gd new file mode 100644 index 0000000..63ce182 --- /dev/null +++ b/Archipelago/messages.gd @@ -0,0 +1,35 @@ +extends Node + + +func _ready(): + var label = Label.new() + label.set_name("label") + label.margin_right = 1920.0 + label.margin_bottom = 1080.0 - 20 + label.margin_left = 20.0 + label.align = Label.ALIGN_LEFT + label.valign = Label.VALIGN_BOTTOM + + var dynamic_font = DynamicFont.new() + dynamic_font.font_data = load("res://fonts/Lingo.ttf") + dynamic_font.size = 36 + dynamic_font.outline_color = Color(0, 0, 0, 1) + dynamic_font.outline_size = 2 + label.add_font_override("font", dynamic_font) + + add_child(label) + + +func showMessage(text): + var label = self.get_node("label") + if !label.text == "": + label.text += "\n" + label.text += text + + yield(get_tree().create_timer(10.0), "timeout") + + var newline = label.text.find("\n") + if newline == -1: + label.text = "" + else: + label.text = label.text.substr(newline + 1) -- cgit 1.4.1