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

30 lines
737 B
GDScript3
Raw Normal View History

2020-07-21 08:51:15 +00:00
extends Control
2020-07-22 15:34:04 +00:00
signal chat_message_sent(text)
2020-07-21 17:47:33 +00:00
onready var log_text = $ResizablePanel/RichTextLabel
2020-07-21 08:51:15 +00:00
onready var chat_bar = $ResizablePanel/LineEdit
2020-07-21 17:47:33 +00:00
func _input(event: InputEvent) -> void:
2020-07-21 08:51:15 +00:00
if event is InputEventMouseButton:
if not chat_bar_focus:
chat_bar.release_focus()
2020-07-22 15:34:04 +00:00
if event.is_action_released("ui_chat") and chat_bar_focus == false:
chat_bar.grab_focus()
2020-07-21 08:51:15 +00:00
2020-07-21 17:47:33 +00:00
func add_line(line: String) -> void:
log_text.append_bbcode(line)
2020-07-21 08:51:15 +00:00
var chat_bar_focus = false
2020-07-21 17:47:33 +00:00
func _chat_bar_status(editing: bool) -> void:
2020-07-21 08:51:15 +00:00
$"/root/scene".writing = editing
2020-07-21 17:47:33 +00:00
func _chat_bar_focus(entered: bool) -> void:
2020-07-21 08:51:15 +00:00
chat_bar_focus = entered
2020-07-22 15:34:04 +00:00
func _text_submitted(text):
emit_signal("chat_message_sent", text)
chat_bar.text = ""
chat_bar.release_focus()