diary/user_interface/chat_panel/message_box.gd

26 lines
723 B
GDScript3
Raw Normal View History

extends PanelContainer
onready var text_edit = get_node("MarginContainer/ContentFitTextEdit")
onready var message_denied_sound = get_node("MessageDeniedSound")
func _ready():
# warning-ignore:return_value_discarded
Users.connect("switched", self, "_on_user_switched")
func _on_message_box_confirmed(content):
if PingSystem.unhandled_ping_count == 0 and not content.empty():
text_edit.text = ""
text_edit._on_text_changed() # To go back to minimum height.
else:
message_denied_sound.play()
func _on_user_switched():
Users.get_inactive().message_box_content = text_edit.text
text_edit.text = Users.get_current().message_box_content
text_edit._on_text_changed() # To adjust height.
text_edit.select_all()