diary/system/data/topic_data/topic.gd

38 lines
824 B
GDScript3
Raw Normal View History

extends Reference
class_name Topic
const TYPE_CASUAL = 0
const TYPE_DAILY = 1
const TYPE_URGENT = 2
const TOPIC_NODE = preload("res://user_interface/topic_panel/topic_node.tscn")
var associated_node: Control
var content: String
2022-05-21 14:56:02 +02:00
var type: int = TYPE_CASUAL
func change_type(new_type: int):
type = new_type
associated_node.type = new_type
associated_node._adjust_appearance_to_user()
Data.topics.dirty_flag = true
func delete():
Data.topics.loaded_topics.erase(self)
associated_node.parent.queue_free()
2022-05-21 14:56:02 +02:00
Data.topics.dirty_flag = true
# Used by the TopicFeed, to spawn topic nodes.
func create_node() -> Control:
var topic_node = TOPIC_NODE.instance()
var editable = topic_node.get_node("TopicEditable")
associated_node = editable
editable.associated_topic = self
editable.type = type
return topic_node