extends ScrollContainer signal change_config(config:Dictionary) signal close var thingy_event = preload("res://scenes/thingy_event.tscn") var events_parser:XMLParser = XMLParser.new() var events = [] @onready var vbc = $"MarginContainer/VBoxContainer/ScrollContainer/VBoxContainer" # Called when the node enters the scene tree for the first time. func _ready() -> void: parse() mount() func parse(): var last_node_name = "" events = [] events_parser.open("res://events/latest_events.xml") while events_parser.read() != ERR_FILE_EOF: var current = events.back() var nt = events_parser.get_node_type() if nt == XMLParser.NODE_TEXT: if last_node_name == "": continue current[last_node_name] = events_parser.get_node_data() elif nt == XMLParser.NODE_ELEMENT: var node_name = events_parser.get_node_name() if node_name == "events": continue elif node_name == "event": events.append({ id = events_parser.get_named_attribute_value_safe("id"), date = events_parser.get_named_attribute_value_safe("date"), tagline = "", title = "", thumb = "", desc = "" }) else: last_node_name = node_name else: last_node_name = "" func mount(): print(events) for event in events: var te = thingy_event.instantiate() vbc.add_child(te) te.event = event te.do_things() te.change_config.connect(change_config.emit) vbc.move_child(te, 0) func _on_close_button_pressed() -> void: close.emit()