Cleanup
This commit is contained in:
@@ -1,31 +0,0 @@
|
|||||||
extends Node
|
|
||||||
|
|
||||||
var items: Dictionary = {}
|
|
||||||
|
|
||||||
func _ready():
|
|
||||||
load_item_data()
|
|
||||||
|
|
||||||
func load_item_data():
|
|
||||||
# 1. Open the JSON file
|
|
||||||
var file = FileAccess.open("res://generator_data.json", FileAccess.READ)
|
|
||||||
var json_text = file.get_as_text()
|
|
||||||
|
|
||||||
# 2. Parse it into a Godot Dictionary
|
|
||||||
var parsed_data = JSON.parse_string(json_text)
|
|
||||||
|
|
||||||
# 3. Loop through and create Custom Resources
|
|
||||||
for key in parsed_data:
|
|
||||||
var data = CurrencyGeneratorData.new()
|
|
||||||
var item_info = parsed_data[key]
|
|
||||||
|
|
||||||
# Populate the resource
|
|
||||||
data.id = key
|
|
||||||
data.name = key
|
|
||||||
data.initial_cost = item_info["initial_cost"]
|
|
||||||
data.coefficient = item_info["coefficient"]
|
|
||||||
data.initial_time = item_info["initial_time"]
|
|
||||||
data.initial_revenue = item_info["initial_revenue"]
|
|
||||||
data.initial_productivity = item_info["initial_productivity"]
|
|
||||||
|
|
||||||
# Store it in our database dictionary
|
|
||||||
items[key] = data
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://cjuinqoug01v1
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
{
|
|
||||||
"generator_1": {
|
|
||||||
"initial_cost": 10,
|
|
||||||
"coefficient": 1.15,
|
|
||||||
"initial_time": 0.6,
|
|
||||||
"initial_revenue": 1.0,
|
|
||||||
"initial_productivity": 1.67
|
|
||||||
},
|
|
||||||
"generator_2": {
|
|
||||||
"initial_cost": 60.0,
|
|
||||||
"coefficient": 1.15,
|
|
||||||
"initial_time": 3.0,
|
|
||||||
"initial_revenue": 60.0,
|
|
||||||
"initial_productivity": 20.0
|
|
||||||
},
|
|
||||||
"generator_3": {
|
|
||||||
"initial_cost": 720.0,
|
|
||||||
"coefficient": 1.14,
|
|
||||||
"initial_time": 6.0,
|
|
||||||
"initial_revenue": 540.0,
|
|
||||||
"initial_productivity": 90.0
|
|
||||||
},
|
|
||||||
"generator_4": {
|
|
||||||
"initial_cost": 8640.0,
|
|
||||||
"coefficient": 1.13,
|
|
||||||
"initial_time": 12.0,
|
|
||||||
"initial_revenue": 4320.0,
|
|
||||||
"initial_productivity": 360.0
|
|
||||||
},
|
|
||||||
"generator_5": {
|
|
||||||
"initial_cost": 103680.0,
|
|
||||||
"coefficient": 1.12,
|
|
||||||
"initial_time": 24.0,
|
|
||||||
"initial_revenue": 51840.0,
|
|
||||||
"initial_productivity": 2160.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user