38 lines
833 B
GDScript
38 lines
833 B
GDScript
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
|
|
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()
|
|
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 = weakref(self)
|
|
editable.type = type
|
|
|
|
return topic_node
|