challenge-editor/scene/save_and_load.gd

51 lines
1.1 KiB
GDScript3
Raw Normal View History

2024-09-19 17:56:05 +08:00
extends Control
2024-10-04 18:08:33 +08:00
signal close
const SAVE_AND_LOAD_MONO = preload("res://scene/save_and_load_mono.tscn")
@export var need_save:bool=false
2024-09-19 17:56:05 +08:00
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
2024-10-04 18:08:33 +08:00
if need_save:
%back.show()
%debug_add.show()
else:
%back.hide()
%debug_add.hide()
#刷新
func fresh():
for i in %mono_add_pos.get_children():
i.queue_free()
var all_save=Global.get_all_save()
for i in all_save.size():
var new_mono=SAVE_AND_LOAD_MONO.instantiate()
2024-10-10 18:09:32 +08:00
new_mono.need_save=need_save
2024-10-04 18:08:33 +08:00
%mono_add_pos.add_child(new_mono)
new_mono.cover.connect(cover.bind(i))
new_mono.load.connect(load_save.bind(i))
new_mono.delete.connect(delete_save.bind(i))
2024-10-10 18:09:32 +08:00
2024-10-04 18:08:33 +08:00
new_mono.set_data(all_save[i])
pass
pass
2024-09-19 17:56:05 +08:00
2024-10-04 18:08:33 +08:00
func _on_tool_button_pressed() -> void:
close.emit()
pass # Replace with function body.
2024-09-19 17:56:05 +08:00
2024-10-04 18:08:33 +08:00
func cover(ind:int):
Global.cover_now_game_to_save(ind)
fresh()
2024-09-19 17:56:05 +08:00
pass
2024-10-04 18:08:33 +08:00
func load_save(ind:int):
Global.load_save(ind)
pass
func delete_save(ind:int):
Global.delete_save(ind)
fresh()
func _on_button_pressed() -> void:
Global.add_now_game_to_save("测试存档")
fresh()
pass # Replace with function body.