Character Roll prototype
This commit is contained in:
52
Root.gd
52
Root.gd
@@ -3,8 +3,46 @@ extends Control
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
||||
pass
|
||||
for file_name in files_to_copy:
|
||||
copy_file_if_not_exists(file_name)
|
||||
|
||||
|
||||
#User Data copy if needed
|
||||
var files_to_copy = [
|
||||
"MemberDatabase/memberData.json",
|
||||
"Boss/bossData.json"
|
||||
]
|
||||
|
||||
var user_directory = OS.get_user_data_dir()
|
||||
|
||||
|
||||
func copy_file_if_not_exists(file_name: String):
|
||||
var user_file_path = "user://" + file_name
|
||||
if not FileAccess.file_exists(user_file_path):
|
||||
var res_file_path = "res://" + file_name
|
||||
if FileAccess.file_exists(res_file_path):
|
||||
var file = FileAccess.open(res_file_path, FileAccess.READ)
|
||||
if file:
|
||||
var data = file.get_as_text()
|
||||
file.close()
|
||||
|
||||
# Write to user:// directory
|
||||
var user_file = FileAccess.open(user_file_path, FileAccess.WRITE)
|
||||
if user_file:
|
||||
user_file.store_string(data)
|
||||
user_file.close()
|
||||
print("Copied ", file_name, " to user:// directory.")
|
||||
else:
|
||||
print("Failed to open destination file: ", user_file_path)
|
||||
user_file.get_open_error()
|
||||
else:
|
||||
print("Failed to open source file: ", res_file_path)
|
||||
else:
|
||||
print("Source file ", res_file_path, " not found.")
|
||||
else:
|
||||
print("File ", user_file_path, " already exists.")
|
||||
|
||||
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
@@ -18,8 +56,16 @@ func _process(delta):
|
||||
Global.globalDamagePerSec = totalDamagePerSec
|
||||
Global.globalDamagePerClick = totalDamagePerClick
|
||||
Global.globalDamageMultiplier = totalDamageMultiplier
|
||||
pass
|
||||
|
||||
#Get the current status of any screens needed
|
||||
var teamScreen = get_node(Global.teamScreenPath)
|
||||
teamScreen.visible = Global.teamScreenVisible
|
||||
|
||||
var teamSelection = get_node(Global.teamSelectionPath)
|
||||
teamSelection.visible = Global.teamSelectionVisible
|
||||
|
||||
var bossScreen = get_node(Global.bossSelectionPath)
|
||||
bossScreen.visible = Global.bossScreenVisible
|
||||
|
||||
func damageEngineCalc():
|
||||
|
||||
|
||||
Reference in New Issue
Block a user