51 lines
1.1 KiB
GDScript
51 lines
1.1 KiB
GDScript
extends Control
|
|
signal close
|
|
const SAVE_AND_LOAD_MONO = preload("res://scene/save_and_load_mono.tscn")
|
|
@export var need_save:bool=false
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
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()
|
|
new_mono.need_save=need_save
|
|
%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))
|
|
|
|
new_mono.set_data(all_save[i])
|
|
pass
|
|
pass
|
|
|
|
func _on_tool_button_pressed() -> void:
|
|
close.emit()
|
|
pass # Replace with function body.
|
|
|
|
func cover(ind:int):
|
|
Global.cover_now_game_to_save(ind)
|
|
fresh()
|
|
|
|
pass
|
|
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.
|