diary/system/data/message_data/message_group.gd

37 lines
932 B
GDScript3
Raw Normal View History

extends Reference
class_name MessageGroup
const MESSAGE_GROUP_CONTAINER = preload("res://user_interface/chat_panel/message_group_container.tscn")
var associated_container: Control
var associated_user: User
var time_stamp: int
var messages := []
func add(message):
messages.append(message)
message.associated_message_group = self
func delete(message):
if messages.size() == 1:
Data.messages.loaded_message_groups.erase(self)
associated_container.queue_free()
return
if message == messages[0]:
messages[1].associated_node.follow_up = false
messages[1].associated_node._adjust_appearance_to_user()
messages.erase(message)
message.associated_node.queue_free()
# Used by the MessageFeed, to spawn message group container nodes.
func create_container() -> Control:
var container = MESSAGE_GROUP_CONTAINER.instance()
associated_container = container
container.associated_message_group = self
return container