Frame-of-Mind/src/dev-util/ingest_board.gd
2022-12-10 11:55:52 +01:00

68 lines
1.9 KiB
GDScript

extends Control
onready var story_list = $board/story_list
onready var card_list = $board/card_list
onready var post_it_list = $board/label_list/postIt_list
onready var connections_list = $board/label_list/connections_list
onready var final_list = $board/final_list
onready var story_template = $"templates/Ingest Story"
onready var card_template = $"templates/Ingest Card"
onready var connection_template = $"templates/Ingest Connection"
onready var post_it_template = $"templates/Ingest Post-It"
onready var pick_template = $templates/Pick
var copybuffer
var pick_source
var all_cards:Array = []
var all_post_its:Array = []
func _on_add_story_pressed():
var tmp = story_template.duplicate()
tmp.show()
story_list.add_child(tmp)
func show_labels(source):
pick_source = source
for child in final_list.get_children():
final_list.remove_child(child)
for post_it in all_post_its:
pick_template.pick = post_it
final_list.add_child(pick_template.duplicate())
func pick(pick):
pick_source.select(pick)
pick_source = null
func copy(buffer):
copybuffer = buffer
func paste():
return copybuffer
func _on_save_pressed():
var save_stories = File.new()
save_stories.open("res://dev-util/export.save", File.WRITE)
var stories = []
for story in story_list.get_children():
stories.append(story.save())
var cards = []
for card in all_cards:
cards.append(card.save())
var postits = []
for postit in all_post_its:
postits.append(postit.save())
var connections = []
for connection in connections_list.get_children():
connections.append(connection.save())
var save_dict = {
stories = stories,
cards = cards,
postits = postits,
connections = connections
}
save_stories.store_line(to_json(save_dict))