diff options
| author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-25 12:09:50 -0400 |
|---|---|---|
| committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-09-25 12:09:50 -0400 |
| commit | 3f53502a5907ed1982d28a392c54331f0c1c2c42 (patch) | |
| tree | 1dd087464d0fba1c35feaab0cee357fca6f2763c /client/Archipelago/messages.gd | |
| parent | fb220e1c75e72a536c19aa1283f905850a91cf44 (diff) | |
| download | lingo2-archipelago-3f53502a5907ed1982d28a392c54331f0c1c2c42.tar.gz lingo2-archipelago-3f53502a5907ed1982d28a392c54331f0c1c2c42.tar.bz2 lingo2-archipelago-3f53502a5907ed1982d28a392c54331f0c1c2c42.zip | |
Move the client into the apworld
Only works on source right now, not as an apworld.
Diffstat (limited to 'client/Archipelago/messages.gd')
| -rw-r--r-- | client/Archipelago/messages.gd | 74 |
1 files changed, 0 insertions, 74 deletions
| diff --git a/client/Archipelago/messages.gd b/client/Archipelago/messages.gd deleted file mode 100644 index ab4f071..0000000 --- a/client/Archipelago/messages.gd +++ /dev/null | |||
| @@ -1,74 +0,0 @@ | |||
| 1 | extends CanvasLayer | ||
| 2 | |||
| 3 | var SCRIPT_rainbowText | ||
| 4 | |||
| 5 | var _message_queue = [] | ||
| 6 | var _font | ||
| 7 | var _container | ||
| 8 | var _ordered_labels = [] | ||
| 9 | |||
| 10 | |||
| 11 | func _ready(): | ||
| 12 | _container = VBoxContainer.new() | ||
| 13 | _container.set_name("Container") | ||
| 14 | _container.anchor_bottom = 1 | ||
| 15 | _container.offset_left = 20.0 | ||
| 16 | _container.offset_right = 1920.0 | ||
| 17 | _container.offset_top = 0.0 | ||
| 18 | _container.offset_bottom = -20.0 | ||
| 19 | _container.alignment = BoxContainer.ALIGNMENT_END | ||
| 20 | _container.mouse_filter = Control.MOUSE_FILTER_IGNORE | ||
| 21 | self.add_child(_container) | ||
| 22 | |||
| 23 | _font = load("res://assets/fonts/Lingo2.ttf") | ||
| 24 | |||
| 25 | |||
| 26 | func _add_message(text): | ||
| 27 | var new_label = RichTextLabel.new() | ||
| 28 | new_label.install_effect(SCRIPT_rainbowText.new()) | ||
| 29 | new_label.push_font(_font) | ||
| 30 | new_label.push_font_size(36) | ||
| 31 | new_label.push_outline_color(Color(0, 0, 0, 1)) | ||
| 32 | new_label.push_outline_size(2) | ||
| 33 | new_label.append_text(text) | ||
| 34 | new_label.fit_content = true | ||
| 35 | |||
| 36 | _container.add_child(new_label) | ||
| 37 | _ordered_labels.push_back(new_label) | ||
| 38 | |||
| 39 | |||
| 40 | func showMessage(text): | ||
| 41 | if _ordered_labels.size() >= 9: | ||
| 42 | _message_queue.append(text) | ||
| 43 | return | ||
| 44 | |||
| 45 | _add_message(text) | ||
| 46 | |||
| 47 | if _ordered_labels.size() > 1: | ||
| 48 | return | ||
| 49 | |||
| 50 | var timeout = 10.0 | ||
| 51 | while !_ordered_labels.is_empty(): | ||
| 52 | await get_tree().create_timer(timeout).timeout | ||
| 53 | |||
| 54 | if !_ordered_labels.is_empty(): | ||
| 55 | var to_remove = _ordered_labels.pop_front() | ||
| 56 | var to_tween = get_tree().create_tween().bind_node(to_remove) | ||
| 57 | to_tween.tween_property(to_remove, "modulate:a", 0.0, 0.5) | ||
| 58 | to_tween.tween_callback(to_remove.queue_free) | ||
| 59 | |||
| 60 | if !_message_queue.is_empty(): | ||
| 61 | var next_msg = _message_queue.pop_front() | ||
| 62 | _add_message(next_msg) | ||
| 63 | |||
| 64 | if timeout > 4: | ||
| 65 | timeout -= 3 | ||
| 66 | |||
| 67 | |||
| 68 | func clear(): | ||
| 69 | _message_queue.clear() | ||
| 70 | |||
| 71 | for message_label in _ordered_labels: | ||
| 72 | message_label.queue_free() | ||
| 73 | |||
| 74 | _ordered_labels.clear() | ||
