ChocolateBird/widgets/SaveSlotSelect.gd

18 lines
464 B
GDScript

extends PanelContainer
#warning-ignore-all:shadowed_variable
signal slot_activated(dict)
onready var slots := [$'%SaveSlot1', $'%SaveSlot2', $'%SaveSlot3', $'%SaveSlot4']
var dicts := []
func set_data(dicts: Array) -> void:
self.dicts = dicts
for i in 4:
slots[i].set_data(dicts[i])
slots[i].connect('clicked', self, 'load_slot', [i])
func load_slot(id: int) -> void:
var dict = self.dicts[id]
if dict.slot_in_use:
emit_signal('slot_activated', dict)