This repository has been archived on 2020-09-30. You can view files and clone it, but cannot push or open issues or pull requests.
odyssey-old/Scenes/UI/Panels/Logs.gd
2020-07-22 17:34:04 +02:00

29 lines
737 B
GDScript

extends Control
signal chat_message_sent(text)
onready var log_text = $ResizablePanel/RichTextLabel
onready var chat_bar = $ResizablePanel/LineEdit
func _input(event: InputEvent) -> void:
if event is InputEventMouseButton:
if not chat_bar_focus:
chat_bar.release_focus()
if event.is_action_released("ui_chat") and chat_bar_focus == false:
chat_bar.grab_focus()
func add_line(line: String) -> void:
log_text.append_bbcode(line)
var chat_bar_focus = false
func _chat_bar_status(editing: bool) -> void:
$"/root/scene".writing = editing
func _chat_bar_focus(entered: bool) -> void:
chat_bar_focus = entered
func _text_submitted(text):
emit_signal("chat_message_sent", text)
chat_bar.text = ""
chat_bar.release_focus()