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

28 lines
938 B
GDScript3
Raw Normal View History

2018-08-18 08:22:19 +00:00
extends VBoxContainer
var line_edit_path = "../../../../footer_box/footer/footer_line_edit"
var new_line_added = false
2018-08-18 08:22:19 +00:00
func _process(delta):
2018-08-19 09:58:35 +00:00
if self.new_line_added:
var content_scroll = get_node( "../.." )
content_scroll.scroll_vertical = 2*self.rect_size.y
2018-08-19 09:58:35 +00:00
self.new_line_added = false
2018-08-18 08:22:19 +00:00
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 = ""
2018-08-19 09:58:35 +00:00
self.new_line_added = true