test-client-godot/gui_scene/GUI/HUD/chat_lines.gd

27 lines
938 B
GDScript

extends VBoxContainer
var line_edit_path = "../../../../footer_box/footer/footer_line_edit"
var new_line_added = false
func _process(delta):
if self.new_line_added:
var content_scroll = get_node( "../.." )
content_scroll.scroll_vertical = 2*self.rect_size.y
self.new_line_added = false
func _on_footer_line_edit_gui_input( event ):
if event is InputEventKey:
if event.is_action_released( "chat_accept" ):
var line_edit = get_node( line_edit_path )
var new_text = line_edit.text
var new_line = RichTextLabel.new()
new_line.bbcode_enabled = true
new_line.bbcode_text = new_text
new_line.rect_min_size.y = global.font_size+4
new_line.scroll_active = false
new_line.selection_enabled = true
self.add_child( new_line )
line_edit.text = ""
self.new_line_added = true