stepstead-client/scripts/splash.gd
jts 6a1706051d İlk commit: Stepstead Godot istemci (4.6 Mobile)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-11 11:31:35 +03:00

32 lines
792 B
GDScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

extends Control
@onready var status_label: Label = $VBox/Status
func _ready() -> void:
status_label.text = "Bağlanılıyor..."
await _check_session()
func _check_session() -> void:
if not Auth.is_logged_in():
_go_login()
return
var res: Dictionary = await Api.request("GET", "/auth/me", null, true)
if not res.ok:
Auth.clear()
_go_login()
return
Auth.user = res.body
var char_res: Dictionary = await GameState.load_character()
if char_res.ok:
_go_game()
else:
_go_character_create()
func _go_login() -> void:
get_tree().change_scene_to_file("res://scenes/login.tscn")
func _go_character_create() -> void:
get_tree().change_scene_to_file("res://scenes/character_create.tscn")
func _go_game() -> void:
get_tree().change_scene_to_file("res://scenes/world.tscn")