feat: Implement core multiplayer features including user authentication, profile management, lobby, game mode managers, and leaderboard.

This commit is contained in:
2026-03-12 03:55:20 +08:00
parent 650d241a72
commit 4f6783b468
13 changed files with 1151 additions and 31 deletions
+23
View File
@@ -22,10 +22,14 @@ extends Control
@onready var reg_confirm_password_input := %RegConfirmPasswordInput as LineEdit
@onready var password_strength := %PasswordStrength as ProgressBar
@onready var password_hint := %PasswordHint as Label
@onready var reg_captcha_question := %RegCaptchaQuestion as Label
@onready var reg_captcha_input := %RegCaptchaInput as LineEdit
@onready var register_button := %RegisterButton as Button
@onready var back_to_login_link := %BackToLoginLink as LinkButton
@onready var reg_status_label := %RegStatusLabel as Label
var current_captcha_answer: int = 0
# Main panel reference
@onready var main_panel := $CenterContainer/MainPanel as PanelContainer
@@ -101,8 +105,16 @@ func _show_registration() -> void:
main_panel.visible = false
registration_panel.visible = true
reg_status_label.text = ""
_generate_captcha()
reg_email_input.grab_focus()
func _generate_captcha() -> void:
var num1 := randi_range(1, 10)
var num2 := randi_range(1, 10)
current_captcha_answer = num1 + num2
reg_captcha_question.text = "Security Check: %d + %d = ?" % [num1, num2]
reg_captcha_input.text = ""
func _show_login() -> void:
registration_panel.visible = false
main_panel.visible = true
@@ -254,6 +266,7 @@ func _on_register_pressed() -> void:
var username := reg_username_input.text.strip_edges()
var password := reg_password_input.text
var confirm_password := reg_confirm_password_input.text
var captcha_answer := reg_captcha_input.text.strip_edges()
# Validation
if email.is_empty():
@@ -288,6 +301,15 @@ func _on_register_pressed() -> void:
_show_reg_error("Password is too weak. Add numbers or symbols.")
return
if captcha_answer.is_empty():
_show_reg_error("Please solve the security check.")
return
if not captcha_answer.is_valid_int() or int(captcha_answer) != current_captcha_answer:
_show_reg_error("Incorrect security check answer.")
_generate_captcha()
return
AuthManager.register_with_email(email, password, username)
func _check_password_strength(password: String) -> void:
@@ -411,6 +433,7 @@ func _set_inputs_enabled(enabled: bool) -> void:
reg_username_input.editable = enabled
reg_password_input.editable = enabled
reg_confirm_password_input.editable = enabled
reg_captcha_input.editable = enabled
func _is_valid_email(email: String) -> bool:
# Simple email validation