Refactor formatting functions and improve item production logic; update UI components for better layout and usability
This commit is contained in:
+26
-27
@@ -2,7 +2,6 @@ extends SceneTree
|
||||
|
||||
func _init():
|
||||
#print("Testing SaveManager...")
|
||||
|
||||
# Instantiate Global manually
|
||||
var global_script = load("res://Autoload/Global.gd")
|
||||
var global_instance = global_script.new()
|
||||
@@ -20,37 +19,37 @@ func _init():
|
||||
|
||||
# Workaround: I'll just copy the logic I want to test.
|
||||
|
||||
var data = global_instance.Owniverse
|
||||
#print("Data to save: ", data)
|
||||
# var data = global_instance.Owniverse
|
||||
# #print("Data to save: ", data)
|
||||
|
||||
var filename = "user://test_save_check.dat"
|
||||
var password = "test"
|
||||
# var filename = "user://test_save_check.dat"
|
||||
# var password = "test"
|
||||
|
||||
var file = FileAccess.open_encrypted_with_pass(filename, FileAccess.WRITE, password)
|
||||
if file == null:
|
||||
print("Error opening file for write: ", FileAccess.get_open_error())
|
||||
quit(1)
|
||||
return
|
||||
# var file = FileAccess.open_encrypted_with_pass(filename, FileAccess.WRITE, password)
|
||||
# if file == null:
|
||||
# print("Error opening file for write: ", FileAccess.get_open_error())
|
||||
# quit(1)
|
||||
# return
|
||||
|
||||
#print("Saving...")
|
||||
file.store_var(data)
|
||||
file.close()
|
||||
# #print("Saving...")
|
||||
# file.store_var(data)
|
||||
# file.close()
|
||||
|
||||
#print("Loading...")
|
||||
file = FileAccess.open_encrypted_with_pass(filename, FileAccess.READ, password)
|
||||
if file == null:
|
||||
printerr("Error opening file for read")
|
||||
quit(1)
|
||||
return
|
||||
# #print("Loading...")
|
||||
# file = FileAccess.open_encrypted_with_pass(filename, FileAccess.READ, password)
|
||||
# if file == null:
|
||||
# printerr("Error opening file for read")
|
||||
# quit(1)
|
||||
# return
|
||||
|
||||
var loaded_data = file.get_var()
|
||||
#print("Loaded data: ", loaded_data)
|
||||
# var loaded_data = file.get_var()
|
||||
# #print("Loaded data: ", loaded_data)
|
||||
|
||||
if str(data) == str(loaded_data):
|
||||
print("SUCCESS: Data matches.")
|
||||
else:
|
||||
printerr("FAILURE: Data mismatch.")
|
||||
print("Original: ", data)
|
||||
print("Loaded: ", loaded_data)
|
||||
# if str(data) == str(loaded_data):
|
||||
# print("SUCCESS: Data matches.")
|
||||
# else:
|
||||
# printerr("FAILURE: Data mismatch.")
|
||||
# print("Original: ", data)
|
||||
# print("Loaded: ", loaded_data)
|
||||
|
||||
quit()
|
||||
|
||||
Reference in New Issue
Block a user