Godot client networking + auth + login/main screens; fix admin hamburger

Server:
- ConnectionLoop: accept auth.login and auth.register as valid first messages
  (not just auth.hello); all ack payloads now include sessionToken for client
  persistence
- IGatewayAuthValidator: add LoginAsync and RegisterAsync
- GatewayAuthValidator: implement both via auth gRPC; fetch displayName from
  ValidateAsync after login/register succeeds
- Admin hamburger: custom .sor-admin-hamburger CSS (hardcoded white, no Bootstrap
  btn-link theme fighting); topbar z-index 1050 with position:sticky

Client (Godot 4.5, GDScript):
- autoloads/Network.gd: WebSocketPeer state machine (CONNECTING / CONNECTED /
  RECONNECTING), exponential backoff (1→30s), app-level keepalive ping every
  30s of idle, 30s ping timeout → reconnect, request/reply correlation by
  sequence number, debug_log_packets export flag for full packet dumps
- autoloads/Auth.gd: drives auth.hello / auth.login / auth.register as first
  WS message; persists sessionToken + userId + displayName to user://auth.cfg;
  auto-resumes saved session on reconnect; auth_success / auth_failed signals
- scenes/login/LoginScreen.tscn + login_screen.gd: Login + Register tabs,
  touch-friendly inputs (44px height), status label, Enter key submits, handles
  reconnect/resume states
- scenes/main/MainScreen.tscn + main_screen.gd: top bar with live connection
  dot, welcome label, placeholder nav buttons, sign-out, redirects to login on
  session expiry
- project.godot: Network and Auth autoloads registered; LoginScreen as main scene

Generated with [Claude Code](https://claude.ai/code)
via [Happy](https://happy.engineering)

Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
dingo
2026-02-27 20:48:53 -05:00
co-authored by Claude Happy
parent af9e335868
commit 3aaabe75e3
12 changed files with 1052 additions and 164 deletions
@@ -0,0 +1,53 @@
extends Control
## Main hub screen — shown after successful authentication.
##
## Displays the player's display name and live connection status.
## Placeholder navigation buttons for future game features.
##
## If auth.hello re-validation fails after a reconnect (expired session),
## Auth.auth_failed fires and we redirect back to the login screen.
@onready var welcome_label : Label = %WelcomeLabel
@onready var status_label : Label = %StatusLabel
@onready var logout_btn : Button = %LogoutBtn
# ── Lifecycle ─────────────────────────────────────────────────────────────────
func _ready() -> void:
welcome_label.text = "Welcome, %s!" % Auth.display_name
Network.connected.connect(_update_status)
Network.disconnected.connect(_update_status)
Auth.auth_failed.connect(_on_auth_failed)
logout_btn.pressed.connect(_on_logout_pressed)
_update_status()
func _exit_tree() -> void:
if Network.connected.is_connected(_update_status):
Network.connected.disconnect(_update_status)
if Network.disconnected.is_connected(_update_status):
Network.disconnected.disconnect(_update_status)
if Auth.auth_failed.is_connected(_on_auth_failed):
Auth.auth_failed.disconnect(_on_auth_failed)
# ── Signal handlers ───────────────────────────────────────────────────────────
func _update_status() -> void:
if Network.is_online():
status_label.text = "● Online"
status_label.modulate = Color(0.3, 0.9, 0.4)
else:
status_label.text = "● Reconnecting…"
status_label.modulate = Color(1.0, 0.8, 0.2)
func _on_auth_failed(_error_code: String, _message: String) -> void:
# Session expired or invalidated — return to login.
get_tree().change_scene_to_file("res://scenes/login/LoginScreen.tscn")
func _on_logout_pressed() -> void:
Auth.logout()
get_tree().change_scene_to_file("res://scenes/login/LoginScreen.tscn")