2022-05-14 20:51:48 +02:00
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 )
2022-06-04 13:33:00 +02:00
message . associated_message_group = weakref ( self )
2022-05-14 20:51:48 +02:00
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
2022-06-04 13:33:00 +02:00
container . associated_message_group = weakref ( self )
2022-05-14 20:51:48 +02:00
return container