summaryrefslogtreecommitdiff
path: root/chat_window.gd
blob: b8636c7ba22a9751bde4899cfe55342458efdcca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
extends PanelContainer


func add_message(message: String):
	var label = Label.new()
	label.text = message
	%ChatWindow.add_child(label)
	
	%ScrollContainer.set_deferred("scroll_vertical", %ScrollContainer.get_v_scroll_bar().max_value)
	# TODO: doesn't reach bottom?


func _on_line_edit_text_submitted(new_text: String) -> void:
	%LineEdit.text = ""
	#add_message(new_text)
	
	var send_chat_message_packet := SendChatMessagePacket.new()
	send_chat_message_packet.message = "%s : %s" % [Client.character.name, new_text]
	Network.map_server.send(send_chat_message_packet)