changes UI to a global singleton
This commit is contained in:
parent
aa4afc4c4b
commit
e3aec75404
16 changed files with 371 additions and 119 deletions
|
|
@ -1,11 +1,19 @@
|
|||
class_name SaveData
|
||||
extends Resource
|
||||
extends Node
|
||||
|
||||
# SIGNALS
|
||||
signal inventory_changed
|
||||
|
||||
# Player data
|
||||
var player_name: String = "Player"
|
||||
var money: int = 0
|
||||
var world: String = "res://scenes/worlds/debug_level.tscn"
|
||||
|
||||
# Inventory data
|
||||
# Items with their unique id and amount
|
||||
|
||||
# Monster Party data
|
||||
# monster with their values (unique id, atk, def, tmp for now)
|
||||
var monsters: Array
|
||||
|
||||
func _init() -> void:
|
||||
set_name("SaveData")
|
||||
|
|
@ -13,7 +21,8 @@ func _init() -> void:
|
|||
func save():
|
||||
var player_data = {
|
||||
"player_name": player_name,
|
||||
"money": money
|
||||
"money": money,
|
||||
"world": world
|
||||
}
|
||||
|
||||
# Collect all data to save in one dictionary
|
||||
|
|
@ -22,3 +31,11 @@ func save():
|
|||
}
|
||||
|
||||
return save_dict
|
||||
|
||||
func setup_new_inventory() -> void:
|
||||
var data = MonsterData.new()
|
||||
data.set_data("debuggy", {}, 5)
|
||||
print("After setting it in inventory: ", data.display_name)
|
||||
|
||||
monsters.append(data)
|
||||
inventory_changed.emit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue