İlk commit: Stepstead Godot istemci (4.6 Mobile)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
commit
6a1706051d
346 changed files with 14415 additions and 0 deletions
32
scripts/login.gd
Normal file
32
scripts/login.gd
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
extends Control
|
||||
|
||||
@onready var email_input: LineEdit = $Panel/VBox/Email
|
||||
@onready var pw_input: LineEdit = $Panel/VBox/Password
|
||||
@onready var login_btn: Button = $Panel/VBox/LoginBtn
|
||||
@onready var register_btn: Button = $Panel/VBox/RegisterBtn
|
||||
@onready var error_label: Label = $Panel/VBox/Error
|
||||
|
||||
func _ready() -> void:
|
||||
error_label.text = ""
|
||||
login_btn.pressed.connect(_on_login)
|
||||
register_btn.pressed.connect(_on_goto_register)
|
||||
|
||||
func _on_login() -> void:
|
||||
error_label.text = ""
|
||||
login_btn.disabled = true
|
||||
var res: Dictionary = await Auth.login(email_input.text.strip_edges(), pw_input.text)
|
||||
login_btn.disabled = false
|
||||
if not res.ok:
|
||||
var detail := "Giriş başarısız"
|
||||
if res.body is Dictionary and res.body.has("detail"):
|
||||
detail = str(res.body["detail"])
|
||||
error_label.text = detail
|
||||
return
|
||||
var char_res: Dictionary = await GameState.load_character()
|
||||
if char_res.ok:
|
||||
get_tree().change_scene_to_file("res://scenes/world.tscn")
|
||||
else:
|
||||
get_tree().change_scene_to_file("res://scenes/character_create.tscn")
|
||||
|
||||
func _on_goto_register() -> void:
|
||||
get_tree().change_scene_to_file("res://scenes/register.tscn")
|
||||
Loading…
Add table
Add a link
Reference in a new issue