aboutsummaryrefslogtreecommitdiff
path: root/client/player/chat_bubble.gd
diff options
context:
space:
mode:
Diffstat (limited to 'client/player/chat_bubble.gd')
-rw-r--r--client/player/chat_bubble.gd22
1 files changed, 22 insertions, 0 deletions
diff --git a/client/player/chat_bubble.gd b/client/player/chat_bubble.gd
index 6b09b69b..1329e198 100644
--- a/client/player/chat_bubble.gd
+++ b/client/player/chat_bubble.gd
@@ -1,7 +1,12 @@
class_name ChatBubble
extends MeshInstance3D
+signal submit_message
+
@onready var label: Label = $SubViewport/ChatMessage/Label
+@onready var input: LineEdit = $LineEdit
+
+var editing := false
func set_text(t: String):
visible = true
@@ -10,3 +15,20 @@ func set_text(t: String):
func remove_text():
visible = false
label.text = ""
+
+func edit():
+ visible = true
+ label.text = ""
+ editing = true
+ input.grab_focus()
+
+func stop_edit():
+ visible = false
+ editing = false
+ input.release_focus()
+ if input.text != "":
+ submit_message.emit(input.text)
+ input.text = ""
+
+func _on_line_edit_text_changed(new_text):
+ label.text = new_text