Reduced number of global variables

This commit is contained in:
2024-02-16 20:04:50 +01:00
parent c228d4e25a
commit d081686275
8 changed files with 29 additions and 33 deletions

View File

@ -10,10 +10,10 @@ func _ready():
var offline := args.has("--offline")
if offline:
Global.username = "Local"
Global.account_id = "test"
Global.auth_token = "test"
Global.player = %PlayerAdd.spawn_player(Global.account_id)
Global.account.id = "test"
Global.account.name = "Local"
Global.account.auth_token = "test"
Global.player = %PlayerAdd.spawn_player(Global.account.id)
%Login.success.emit()
else:
%Login.send_login()
@ -24,16 +24,16 @@ func _input(event):
get_viewport().set_input_as_handled()
func on_login():
print("[%s] Login succeeded." % Global.username)
print("[%s] ID: %s" % [Global.username, Global.account_id])
print("[%s] Auth token: %s" % [Global.username, Global.auth_token])
print("[%s] Login succeeded." % Global.account.name)
print("[%s] ID: %s" % [Global.account.name, Global.account.id])
print("[%s] Auth token: %s" % [Global.account.name, Global.account.auth_token])
DisplayServer.window_set_title("%s - %s" % [Global.username, Global.account_id])
DisplayServer.window_set_title("%s - %s" % [Global.account.name, Global.account.id])
DisplayServer.window_set_position(Vector2((Global.instance_id % 2) * 960, (Global.instance_id / 2 % 2) * 540))
pause(false)
func on_logout():
print("[%s] Logout." % Global.username)
print("[%s] Logout." % Global.account.name)
pause(true)
func pause(enabled: bool):