You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.8 KiB

6 months ago
extends Control
@onready var _global_scn = get_node("/root/Global")
const Response = preload("../util/Response.gd")
6 months ago
# Called when the node enters the scene tree for the first time.
func _ready():
if _global_scn.user_name:
Dialogic.VAR.user = _global_scn.user_name
var dojo : Dictionary = await _global_scn.get_dojo()
if not dojo.is_empty():
Dialogic.VAR.dojo = dojo['name']
var user : Dictionary = await _global_scn.get_user()
if user.has("properties") and user["properties"] is Dictionary:
var properties: Dictionary = user["properties"]
Dialogic.VAR.bg.clan = properties.get("bg.clan", "")
Dialogic.VAR.bg.community = properties.get("bg.community", "")
Dialogic.VAR.bg.country = properties.get("bg.country", "")
Dialogic.VAR.bg.username = properties.get("bg.username", "")
6 months ago
Dialogic.signal_event.connect(_on_dialogic_signal)
Dialogic.start("res://timelines/new_player_wizard.dtl")
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(_delta):
pass
func _on_dialogic_signal(argument:String):
Dialogic.paused = true
6 months ago
if argument == "create_dojo":
var result: Response = await _global_scn.create_dojo(Dialogic.VAR.newdojo)
if result.status == OK:
Dialogic.VAR.dojo = Dialogic.VAR.newdojo
else:
print_debug("%s failed: %s - %s" % [argument, result.code, result.data])
elif argument == "update_preferences":
var result: Response = await _global_scn.update_user_preferences({
"bg.clan": Dialogic.VAR.bg.clan,
"bg.community": Dialogic.VAR.bg.community,
"bg.country": Dialogic.VAR.bg.country,
"bg.username": Dialogic.VAR.bg.username
})
if result.status == OK:
print_debug("Update preferences was successful!")
else:
print_debug("Update preferences failed: %s - %s" % [result.code, result.data])
elif argument == "the_end":
return
Dialogic.paused = false