miggor-StreamGraph/classes/deck/deck_holder.gd
Lera Elvoé fa5e9997ef merge groups (#2)
here we go

Reviewed-on: https://codeberg.org/Eroax/Re-DotDeck/pulls/2
Co-authored-by: Lera Elvoé <yagich@poto.cafe>
Co-committed-by: Lera Elvoé <yagich@poto.cafe>
2023-11-22 04:26:11 +00:00

27 lines
538 B
GDScript

class_name DeckHolder
static var decks: Array[Deck]
static func add_empty_deck() -> Deck:
var deck := Deck.new()
DeckHolder.decks.append(deck)
var uuid := UUID.v4()
deck.id = uuid
return deck
static func open_deck_from_file(path: String) -> Deck:
var f := FileAccess.open(path, FileAccess.READ)
if f.get_error() != OK:
return null
var deck := Deck.from_dict(JSON.parse_string(f.get_as_text()), path)
DeckHolder.decks.append(deck)
return deck
static func close_deck(deck: Deck) -> void:
DeckHolder.decks.erase(deck)