29 lines
669 B
GDScript3
29 lines
669 B
GDScript3
|
extends Reference
|
||
|
class_name Message
|
||
|
|
||
|
const MESSAGE_NODE = preload("res://user_interface/chat_panel/message_node.tscn")
|
||
|
|
||
|
var associated_node: Control
|
||
|
var associated_message_group: MessageGroup
|
||
|
|
||
|
var content: String
|
||
|
var time_stamp: int
|
||
|
|
||
|
|
||
|
func get_user() -> User:
|
||
|
return associated_message_group.associated_user
|
||
|
|
||
|
|
||
|
func delete():
|
||
|
associated_message_group.delete(self)
|
||
|
|
||
|
|
||
|
# Used by the MessageFeed, to spawn message nodes.
|
||
|
func create_node() -> Control:
|
||
|
var message_node = MESSAGE_NODE.instance()
|
||
|
associated_node = message_node
|
||
|
message_node.associated_message = self
|
||
|
if associated_message_group.messages.size() > 1:
|
||
|
message_node.follow_up = true
|
||
|
return message_node
|